I imagine you get to this in part 2 but I just wanted to state that datetime values should always be generated for storage in UTC, and then converted to local times only for ephemeral display purposes, if and when necessary. For browser based systems the UTC value should be delivered intact to the browser and then converted to the locale of the OS they are displayed on. For server apps, log files and everything else, UTC should be the only timezone. I can't tell you how many times I have had to guess what timezone different log files were generated in.

I would argue that naive datetimes shouldn't even exist since they are essentially indeterminate values in any global system.

Expand full comment

Oh yes, I'd agree with that for any application that uses time. In this post, I was merely creating a small utility to convert between timezones rather than anything more involved, but yes, you make a great point!

Expand full comment