by wolf550e · 4y ago · 0 comments
That is why logs (moment of time in the past) should be stored in UTC (possibly with local or user's timezone name for UI), timers (short offsets into the future from a moment of time in the past) should be stored in UTC like logs, and future scheduled events between humans should be stored in local time with the name of the timezone. The name of a timezone is never the offset, it is always the jurisdiction that can change the rules and be merged into another, etc.
When answering the question "what is the UTC time of a future scheduled appointment?", which is equivalent to "does it intersect a future scheduled appointment set in a different timezone on the same or adjacent dates?", which is also equivalent to the question "how many seconds in the future is this from right now?", you must assume the timezone rules set by politicians will not change between now and the appointment time. If the appointment time is soon (e.g. under 3 months), you indeed can assume this, because legislating an unexpected timezone change that will take effect "soon" is stupid and will usually not be done. But for a scheduled appointment a year from now? You honestly don't know. You can guess, but you must assume this can change by a TZ database update and act accordingly. If you have converted from localtime to UTC when the appointment was created, it is difficult to adjust correctly when TZ db is updated. If you translate to UTC only "just in time" when rendering or detecting collisions, everything will work correctly.
Also political changes often bring TZ changes, most obviously when larger countries split into smaller ones. But changing trade patterns can lead to TZ and DST changes, such as when Samoa skipped forward 24 hours, skipping Dec 30 2011 completely, putting them in the same timezone as Australia and New Zealand.
https://www.theguardian.com/world/2011/dec/30/samoa-loses-da...
It also had July 4 1892 occur twice, due to originally having moved back 24 hours to align with the US.