You are reading a single comment by @stephenPspackman and its replies. Click here to read the full conversation.
  • Hey, Gordon.

    Without disagreeing in any way that the most direct thing to do is E.setTimeZone(amt, name), I took a few more steps down the rabbit hole of looking at scheduled DST changes. It seems there are some peculiarities baked into E.setDST()? First, it already has 12 parameters(!), which means that unlike E.setTimeZone() it can't straightforwardly take optional time zone name parameters at the end. Second, to the point of not breaking existing uses, it appears from reading the code that widdst depends on the fact that setDST disables setTimeZone to prevent further host time zone updates, and thus relies on the host not calling setDST, since that would break the override.

    So … one might wish that the entry had been setDST(base, delta, startRule, endRule) where startRule and endRule are arrays, for example. And while preventing automatic updates is a sensible idea, it might be better to have said Bangle.setEnableAutomaticTimezone(false)­ explicitly, rather than accomplishing it by implicitly disabling setTimeZone.

    It seems wrong to set up a competing version of setDST, but then again it seems—if my reading of the code is correct, of course—that widdst is relying on being the sole user of the call!

    Given this, I can imagine several ways forward to ‘rescue’ on-device DST processing, each slightly ugly in its own way:

    1. Change the interface of setDST breakingly, updating any clients that use it, and split off an explicit setEnableAutomaticTimezone() entrypoint;
    2. Keep all existing entrypoints unchanged and add a new one that allows setting DST under a slightly different interface, while (like setTimeZone) being implicitly disabled by setDST;
    3. Extend setTimeZone so that it takes an optional label and optional rules to schedule changes (again while maintaining the peculiar interaction with setDST, now exactly as documented);
    4. Like (2) or (3), but adding the explicit override mechanism from (1).

    What, if anything, would you like for your baby? :) I'm a bit sad to give up prospective DST advice, but if your response is just to leave it and go with the minimal thing, I'll live. ;)

About