by spiffytech · 4y ago · 0 comments
If a user wants a calendar event at 9am, they probably still mean 9am after accounting for time zone or DST changes.
Storing dates as UTC is appropriate for dates in the past, or future dates that a user will never expect to happen at a certain wall-clock time.
(An IANA zone name is something like America/New_York, and not EST or UTC-05:00)
Or if it's a fixed time, not to be moved by DST changes anywhere, they could specify it in UTC.
It's also a good idea to calculate and save the offset when editing. Then, if the offset changes later, you can notify the user. Hey, this appointment is affected by DST change, when do you want it to be?
Which is often what we want!
So on that regard, I find calendar invites rather than a causal email invite to be essential.
Bonus: geopolitics change country lines, and that affects time zones as well. When the time zone at the appointment location changes due to border conflicts, you can get the new time zone without having to change anything.
Never mind, if you had a fully booked schedule collaborating across timezones and someone's government adjusts local time, now you've got a mess.
Save the time and timezone of the event in the other country, so literally the time it starts not the calculated local time.
Unless the other country decides to switch timezones, well then you are screwed.
Of course, times sometimes do need timezones. But calendar dates (like Christmas, or your birthday) almost never do and having things automagically do adjustments based on that and give the wrong results is just a pain.
That's one thing I don't like about many standard libraries. They'll have a DateTime object that does all kinds of automagic stuff for you (or against you), but no concept of just a date itself. Many bugs occur between 2300 and 0100 due to that (and sometimes between 1100 and 1300 because people try to compensate for the buggy adjustments by setting the unwanted time component to noon).
Another problem arises when the server's timezone is set to X, the database's timezone is Y, the software's timezone is Z, and one user's entering data in timezone A while another is reading it in timezone B - and all of the software parts along the way are each trying to automagically adjust it. A good reason we should just all switch to UTC and drop the idea of timezones entirely.
Also some events aren’t related to human activity and you would rather not make that adjustment. It can be tricky to know which is which.
...9am of their timezone or 9am of other participants time zone ?
Countries also share a timezone, what happens when they stop ?
what if you store time in CEST but the date CEST changes into CET is different in different countries ?
People easily forget that others in a meeting loop are in different time zones.
Not so bad in parts Europe or the UK, but for those of us in countries with multiple TZs like the US and Australia, it’s a persistent problem!
Especially for those junior members who are new to the group video conferencing game!
Conveying TimeZones in software is also a UX issue I’ve found! People don’t really understand LOL
When railways were introduced a multitude of local timezones made railway timetables impossible, this then led to the present system.