DEV Community 👩‍💻👨‍💻

Discussion on: 3 simple rules for effectively handling dates and timezones

garzo profile image
Dave MG

Asking as an Ops engineer, this sounds relevant and something to have in the "nice to know" mental-stack-but what would be an example edge-case you speak of here?

thedfresh profile image
thedfresh • Edited on

Man, I wrote some massive emails trying to work through this once upon a time, but here's a pretty simple way to think about it.

In 2005 the US moved the end of DST from the last Sunday in October to the first Sunday in November starting in 2007. So the UTC datetime for 8am November 1 in Boston in 2006 was 2006-11-01T13:00:00+00:00, but 2007-11-01T12:00:00+00:00 the following year. This is never a problem for historical dates because your TZ library knows what the UTC/DST offset was for any time zone on any date. What it does not know is what the UTC/DST offset will definitely be on future dates.