4 ms·
I'm genuinely interested in learning more about the problems that midnight-GMT-as-date-only can lead to. It's used on a project I currently work on. Do you hav
by blago 5y ago
I'm genuinely interested in learning more about the problems that midnight-GMT-as-date-only can lead to. It's used on a project I currently work on. Do you have a link or can you spare a few minutes to explain?
- dexwiz 5y agoGenerally you end up with some “apply offset” code that tries to convert between an date time and a date by applying the timezone offset. This generally works but is full of edge cases. For example on days with DLS changes the offset is not the same throughout the day, so you need extra logic to figure out what is the correct offset. Also most code is usually only tested in the dev’s timezone. So you can write code that works in a negative offset but has bugs in positive offsets or vice versa. Another issue is the mental burden of knowing when a time stamp is supposed to be a date or a date time. You cannot write a reliable method to differentiate them because there will be valid date times that are exactly at GMT midnight. Fundamentally dates and date times (instants) are different. Christmas is December 25th in Australia and the USA. But the instants that those time zones experience that date are different. People forget this and will try to treat the GMT midnight as a date time, when it should be a date.