Live data from Hacker News

Temporal: The 9-year journey to fix time in JavaScript

bloomberg.github.io

231–240 of 284 posts

Re: Temporal: The 9-year journey to fix time in JavaScript

#231

Earlier quoted context omitted.

What you want there is to stop saying "day" and instead say "24 hours." This way the code is correct and you don't need to deal with time weirdness.

No, because if I want something to happen everyday at 12 o'clock, I have to wait for one day, if I wait for 24 hours, I will be off by an hour for half of the year.

Only if you live in one of the brain dead countries that observe the dst anachronism.

Re: Temporal: The 9-year journey to fix time in JavaScript

#232

Earlier quoted context omitted.

Agreed. We've almost eradicated our usage of JS Date - fixing plenty of bugs along the way, and then I extracted thousands of lines of conversions and formatting from our production app (scheduling focused) into a temporal-fun package to make it Temporal more ergonomic for lots of common cases. npmjs.com/package/temporal-fun

Word of warning Temporal relies on the Intl API for formatting, and support in Chrome is very limited due to their binary size constraints. As a result, you'll need to polyfill unsupported languages using format.js

  $ du -sh '/Applications/Google Chrome.app'
   1.3G    /Applications/Google Chrome.app

Re: Temporal: The 9-year journey to fix time in JavaScript

#234
post #232

Earlier quoted context omitted.

Word of warning Temporal relies on the Intl API for formatting, and support in Chrome is very limited due to their binary size constraints. As a result, you'll need to polyfill unsupported languages using format.js

$ du -sh '/Applications/Google Chrome.app' 1.3G /Applications/Google Chrome.app

There are numerous reports on this being an issue e.g. https://issues.chromium.org/issues/40624456

Re: Temporal: The 9-year journey to fix time in JavaScript

#235
post #227

Earlier quoted context omitted.

Agreed. We've almost eradicated our usage of JS Date - fixing plenty of bugs along the way, and then I extracted thousands of lines of conversions and formatting from our production app (scheduling focused) into a temporal-fun package to make it Temporal more ergonomic for lots of common cases. npmjs.com/package/temporal-fun

That looks neat although your package is missing a link to the source repository.

Good catch. Will get that added today.

github.com/howie-code/temporal-fun

Re: Temporal: The 9-year journey to fix time in JavaScript

#236
post #232

Earlier quoted context omitted.

$ du -sh '/Applications/Google Chrome.app' 1.3G /Applications/Google Chrome.app

There are numerous reports on this being an issue e.g. https://issues.chromium.org/issues/40624456

Thanks for the heads up. Will think on this and will probably just document the polyfill.

Re: Temporal: The 9-year journey to fix time in JavaScript

#237
post #12

Would have been interesting to connect back to Java's own journey to improve its time APIs, with Joda-Time leading into JSR 310, released with Java 8 in 2014. Immutable representations, instants, proper timezone support etc. Given that the article refers to the "radical proposal" to bring these features to JavaScript came in 2018, surely Java's own solutions had some influence?

I'm in the C# world and can attribute most of my understanding about dates and times to Noda (the .NET version of Joda). Shout out to Jon Skeet for maintaining it.

Re: Temporal: The 9-year journey to fix time in JavaScript

#239
post #125

Earlier quoted context omitted.

> Right now the world needs a lot more Safari and Firefox users complaining about Chrome-only sites and tools than it does people complaining about Safari "holding the web back". There wouldn't be Chrome-only sites and tools if Safari wasn't holding the web back (no "quotes" needed, as that's precisely what they're doing). > Safari's problems are temporary. What are you talking about? They've been woefully behind for…

> There wouldn't be Chrome-only sites and tools if Safari wasn't holding the web back (no "quotes" needed, as that's precisely what they're doing). It's a matter of perspective. The safer perspective is: Safari isn't holding the web back, Chrome is moving too fast. Developers making Chrome-only sites and tools are moving too fast for the safety of web standards/web platform. Where one of the safety factors is "widely…

As the links I shared showed in tremendous detail, everything you've said is complete nonsense.

Re: Temporal: The 9-year journey to fix time in JavaScript

#240

I'm very happy about this. The fact that Temporal forces you to actually deal with the inherent complexities of time management (primarily the distinction between an instant and a calendar datetime) makes it incredibly difficult to make the mistakes that Date almost seems designed to cause. It's a bit more verbose, but I'll take writing a handful of extra characters over being called at 3AM to fix a DST related bug a…

Technically, you're not likely to to have to fix a DST bug at 3AM any day but Sunday.

Some countries alter their observance of DST in line with their observance of Ramadan, which means that the time-offset changes aligned with Ramadan.

Ramadan is observed from one visual sighting of a crescent moon to the next.

Cloud conditions may prevent sighting and thereby alter the official start of Ramadan for an individual location, and from time-to-time, the start of a country's change in timezone.

Post reply on HN