Monday, November 5, 2018

Daylight Savings Time and hardcoded date formats

This morning I woke up to discover that my app was broken. It was unable to parse date-times from the API it uses because of a format mismatch. When I originally wrote that bit of code, I saw that there was a timezone fragment (containing the offset from UTC) that was always the same, since the app is for a transportation system within one time zone. But when Daylight Savings Time ended, the offset shifted by an hour, making the strings not match the literal timezone fragment. I suppose the moral of the story is to be very careful with timezones because DST transitions will wreak havoc.

No comments:

Post a Comment