4 ms·
As a web dev, I've spent more time and effort debugging datetime issues (across the frontend, backend, databases, and customer implementations) than all other c
by solardev 3y ago
As a web dev, I've spent more time and effort debugging datetime issues (across the frontend, backend, databases, and customer implementations) than all other classes of bugs put together. It feels like every year there are many days/weeks spent looking for these these, fixing them individually, and fixing them again at the meta level to account for the different ways people tried to fix them individually :(
The most enduring fix is almost always like you said, store timestamps in UTC (plus a zone name string separately, because an offset isn't always enough), plus use standard libs instead of trying to do your own datetime or time zone math, then format timestamps into human readable localized dates as late as possible for the user. In JS that means Luxon or date-fns instead of the woefully inadequate built-in Date methods.