Hacker News new | ask | show | jobs
by MrJohz 992 days ago
This is the fundamental limitation of the current built-in API, and the reason that Temporal is necessary: a Date object has no concept of timezones, and there is no way to inject that into it. It can kind of comprehend that UTC exists, and you can pass dates into the relevant Intl API and get dates formatted in the right timezone, but doing maths on different timezones is nearly impossible to do correctly.

This is the biggest flaw with date-fns - it's great if you're only working with naive timestamps where timezones aren't an issue, but there's fundamentally no way to get things to work correctly when timezones do show up.

1 comments

I think Date is worse that something that has no concept of timezones. It has just enough of a concept of timezones to mess things up, but not enough to implement anything correctly.