It's only the second time I dare share a link to an article I wrote. I find it intimidating, honestly.
I put a ton of effort into writing the article (and creating the no-dependencies runnable-script widget). Would love your feedback / constructive criticism :)
Funnily enough, date-fns-tz is MUCH worse than moment-timezone, so much so that I'm regretting making the decision to migrate. It works by fundamentally altering the Unix timestamp of the underlying date, so that when you format() it, the times appear correct. But try to actually pull a unix seconds out of it and you're screwed.
I should have stuck with the larger bundle size. Aside from Moment being mutable and non-tree-shakeable, the api is better in every way if you care about fixed, non-local timezones.
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.
Have you tried Luxon?
If your frontend isn't completely critical, you might be ok with the temporal-api polyfill, too. It's a joy to use.
deno repl --v8-flags=--harmony-temporal
I couldn't test it in bun, but it should be the same thing, except that it depends on JavaScriptCore instead of v8. But basically nodejs, deno and bun don't really need to do anything — just wait for v8 and JSCore.
Browsers are waiting for the proposal to signal that it's ready to be unflagged. Right now it states it must be behind a flag.