5 ms·
bflesch might be suggesting that you (or some other motivated + heroic person) write a new spec for calendar collaboration, like what jmap.io is trying to do fo
by philsnow 2y ago
bflesch might be suggesting that you (or some other motivated + heroic person) write a new spec for calendar collaboration, like what jmap.io is trying to do for mail.
I know that calendars and datetime management suck, hard. I hazard a guess that several people have already started trying to replace caldav (because of the suckage of caldav) and have quietly given up (because of the suckage of datetimes and timezones).
- kridsdale3 2y agoIndeed they do. The hardest bugfix I ever had to do (which I go back to whenever interviews ask that question) was a timezone bug that was going to ruin the iOS 7 on-stage reveal. It only reproduced in customer builds and customer hardware, which we could not debug or get root on. Anyway we traced it to a confluence of rare conditions in a date-math C file that had not been modified since 1987, and was in a completely different style from everything else in the OS. The edge-iest of edge cases. It was hard because of the debugging blindness, not so much date-math itself. We had to do hardware-level things.
- fc417fc802 2y agoI thought the solution to datetime was almost always to use TAI plus a library to convert for display in the UI. (Or UTC and accept that leap seconds might cause bugs.)
- thequux 2y agoCalendar apps expose all of the weird edge cases in dates and times. For a specific instance of a specific event that never needs to move, TAI will work. However, suppose that you schedule a meeting for 28 March at 13:00. You then move that meeting forward a week, crossing a DST switch. If you simply add 604800 seconds to the TAI, that meeting will be at 14:00, which is surprising. OK, easy enough to solve; convert the TAI back to the local timezone, add 7 to the day field (carrying into month and year, as needed), and you're good to go. Now suppose that the meeting was set up in the US, and you realized that you needed to reschedule the meeting while you were travelling in Germany. You get back to the US, and suddenly the meeting is an hour early, because DST rules aren't universal. Worse, imagine a recurring meeting, every week at noon. You've got the TAI for the original instance, but as you cross a DST boundary, some places will shift according to DST and others won't, and thus you have half the attendees showing up at the wrong time. Finally, TAI introduces the leap second bug for calendars. When you schedule a meeting for noon next year, you want that to happen at noon, not now plus however many seconds. If a leap second is introduced, you don't want that meeting to happen at one second before or after noon. TBH, if you find yourself in a situation where you need to deal with calendar events, I recommend updating your CV.
- fc417fc802 2y agoI'll preface this by stating that I fully realize that localized datetime is absolutely byzantine and fraught with difficulties. That's the rationale for leaving it to an external library as close to 100% of the time as possible. I also realize that there might well be complexities involved in calendar software that I'm unaware of. Hence my comment - I'm genuinely interested to learn. That said, I think your examples are all fairly clear examples of errors in reasoning by the programmer. Specifically they stem from conceptual mistakes regarding the relation of different logic domains (by which I'm referring to storage, display, scheduling, etc). You never move events around in TAI (the unambiguous storage format) just as you don't go manually flipping bits in an SQLite database. You always work in a localized time because that's what the user is reasoning in. And you use the datetime library to implement as much of those manipulations as possible. > US vs Germany, conflicting DST rules. Go back to the era before smartphones and PDAs and the internet. You're in Germany on a business trip. You call your secretary to reschedule next weeks meeting back home. You don't use German time when doing that, you use US time. Events have a location which has a timezone. Scheduling happens in that timezone. Blindly using the current local timezone of the device is a reasoning error. Storage, scheduling, and presentation are distinct logic domains. > you have half the attendees showing up at the wrong time. There is a single unique TAI time for a given event (after all that's the entire point of using UTC or TAI or what have you). All attendees will see an equivalent local time barring a bug in the datetime library. See my earlier point regarding which timezone to use for the computation. > TAI introduces the leap second bug for calendars. Only if you make the mistake of attempting to manually manipulate your data storage format. The point of TAI as opposed to UTC in this specific case is to offload the complexity of handling leap seconds onto the datetime library so that you don't need to worry about it.
- et1337 2y agoThe problem is TAI is not the source of truth in real life. In real life, Arizona can change its laws and suddenly that event is going to happen at a different TAI timestamp. That’s why the unambiguous storage format has to be a date time with time zone, and not just a timestamp.