Live data from Hacker News

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

bloomberg.github.io

261–270 of 284 posts

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

#261

And yet another modernisation of the web platform sabotaged by Apple and their misguided (malicious?) refusal to update their devices continually. https://caniuse.com/temporal It will take years until this can be widely used as intended.

The spec hasn't even reached stage 4 yet. Chrome only added support 58 days ago. Safari already added support in their alphas.

The specification reached stage 4 just yesterday. That was the motive behind the blog post :)

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

#262
post #254

Earlier quoted context omitted.

The only well supported and consistent argument I see in those links is that Safari is bad at PWAs. I agree with that. But (timely rant incoming) I also think everyone is currently bad at PWAs. The current ServiceWorker-based approach is brittle and hard to use because it is too low level and too tightly coupled to what seem to be Chrome-specific concerns. The previous manifest.json approach should have never been di…

It is bizarre that you're "pinning" this on the Chromium engineers - who are essentially the only ones moving the web forward. The safari feet dragging/obstruction goes far beyond PWAs. The chart on this page is one of many examples showing how consistently far behind Safari is - they've been enormously behind chrome and firefox in coverage of tests for 7+ years. https://wpt.fyi/ . And here's an extremely comprehensi…

> It is bizarre that you're "pinning" this on the Chromium engineers - who are essentially the only ones moving the web forward.

I'm saying this is exactly the problem. If the perception is that only one browser is "moving forward" and the rest are just chasing that moving target, that's not healthy and it is not a standards process. WHATWG has always been at risk of "regulatory capture" by Google or at least Chromium interests. More so than ever there are standards that seems like WHATWG rubber stamped whatever Chrome decided to do without larger consensus work with Safari and Firefox. That's really dangerous for the web platform. (And W3C lost to WHATWG and seems increasingly irrelevant as a standards body for HTML.)

I think we are all very lucky that ECMA hasn't so far shown the same risk and TC-39 (JS) continues to look overall diverse and healthy.

> Google doesn't and, in fact, can't "make standards". Standards are something that comes about through the painful diplomatic process described in those links.

This is why I put standards in quotes in most of that comment. I do think WHATWG has already signed off on Chrome-first things as "standards" that aren't in the sense of multiple robust implementations and a diverse enough number of stakeholders that aren't just using Chromium-derived codebases. I worry WHATWG is at risk of getting worse in this.

> As for MPA PWAs, there's nothing at all stopping you from serving pages from a service worker. There's plenty of valid and accessible ways to precache all the pages that a user might need while offline. Workbox (from Google!) makes it easy, but its also easy to hand-roll.

As very personal experience from building PWAs (and failing to build many more of them): Workbox is bloated and awful to work with and is bad enough at SPAs that trying to feed it an MPA makes me want to scream just thinking about it. Hand-rolling a Service Worker remains a nightmare because the API is awful to work with by hand, which is the whole reason Workbox exists. There's something very wrong with the APIs that right now the only answer seems to be "just use Workbox". That's not healthy for the web platform to be so dependent on a single vendor's tool to get over the hump of using a web API. (Even if that tool is open source. CVEs affect open source like everything else.)

The last time I was serious about PWA development I broke down in tears and switched to Ionic's Capacitor and Electron because browser wrappers are still too much easier than writing a PWA.

I know that isn't just me also anecdotally by the number of Electron apps running on my machine even right now (a bunch) and the number of PWA apps running on my machine (none).

Statistically Service Workers and Workbox are massive failures, and it isn't Apple's fault and it is weird to me claiming that it is entirely Apple's fault. If you don't want to blame Google or at least Chromium engineers, that's fine, we don't have to agree on that. But show me the app with a working PWA ServiceWorker that has a good reliable caching strategy, good offline-first support, and people use that offline-first capability regularly and I'll show you a unicorn. The APIs are terrible, the standards should be better. If we don't want to point fingers at why the current APIs and standards are so awful, can we at least find someone to point a finger at who is actively working to make them better? It doesn't seem to be "Just Use Workbox" Chromium. Who is actually trying to move the offline-first web forward towards pragmatic reality and not just "we support it in theory, with this one JS library, but very few are using it in practice and almost none successfully"?

> And, Microsoft most definitely has not given up on the web platform - they literally adopted and make contributions to chromium. The author of that site literally works at Microsoft now, coaching both internal and external teams on improving their use of the web, as well as contributing to standards.

When Microsoft switched to Chromium they soft laid off a lot of their web platform staff. Chromium Edge's outward development focus seems to be AI and First-Party Coupon Cutting Extensions.

Spartan Edge had ideals and seemed to really believe in the PWA as a first class application platform. For a time, I had a bunch of PWAs as daily use applications in Windows 8 and early 10 (not all of which I built myself, either). That era is certainly gone now. WebView2 is making some inroads in reduce the reliance on Electron by certain types of apps, but WebView2 isn't a PWA platform, it is another end run around it/away from it.

> I dont see any point in continuing this discussion, as you haven't shown even the slightest interest in considering how you're living in some bizarro world.

> If you are actually attempting to communicate in good faith

You've strayed close enough to the realm of ad hominem attacks that I'm going to stop here. It doesn't sound like we are going to ever agree, but certainly not because I'm not debating in "good faith" or living in some "bizarro world". It seems rude to me to imply such accusations. Just because I have a different perspective doesn't make me a bad actor nor prove I have some sort of mental health issues. I may have experienced a different world than you have in my career, but there was nothing "bizarro" or worse about it. Different perspectives should be a joy to engage with, not an affront to ridicule. I'm sorry I couldn't find help you find common ground.

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

#263

Earlier quoted context omitted.

What would have been wrong with Temporal.now() returning a sensible value?

What counts as a sensible value? The whole point of the library is to be explicitly about what kind of date/time data you're working with, because different kinds of data have to be handled in very different ways.

If they at least had a Temporal.nowlocal() and a Temporal.nowUTC() that returned a ZonedDateTime set to the local and UTC timezones respectively, that would be 95% of what developers need in practice.

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

#264
post #254

Earlier quoted context omitted.

It is bizarre that you're "pinning" this on the Chromium engineers - who are essentially the only ones moving the web forward. The safari feet dragging/obstruction goes far beyond PWAs. The chart on this page is one of many examples showing how consistently far behind Safari is - they've been enormously behind chrome and firefox in coverage of tests for 7+ years. https://wpt.fyi/ . And here's an extremely comprehensi…

> It is bizarre that you're "pinning" this on the Chromium engineers - who are essentially the only ones moving the web forward. I'm saying this is exactly the problem. If the perception is that only one browser is "moving forward" and the rest are just chasing that moving target, that's not healthy and it is not a standards process. WHATWG has always been at risk of "regulatory capture" by Google or at least Chromiu…

it would, indeed, be great if there were others contributing to the web. Mozilla should be, but they seem to be run by incompetent grifters. Apple could be, but that would be completely against their interests. So we're left with chromium moving the web forward - that's not their fault and its ludicrous that you keep saying it is.

as for service worker, I literally said you dont need workbox. I have done lots of hand-rolled MPA caching. Its dead-simple, so i dont know what complexity you're referring to.

As for the fact that there arent many good pwas out there - people dont bother because iphone is a mess. Your arguments would hold water if apple allowed other browser engines and then pwas still languished.

Even still, there's all sorts of efforts towards offline/local-first. Its a hard problem to solve. But, again, simple MPA caching is not hard. If its a dynamic backend, then that would be much more difficult

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

#265

And yet another modernisation of the web platform sabotaged by Apple and their misguided (malicious?) refusal to update their devices continually. https://caniuse.com/temporal It will take years until this can be widely used as intended.

The spec hasn't even reached stage 4 yet. Chrome only added support 58 days ago. Safari already added support in their alphas.

Sure and that’s nice going forward. Yet unlike with Chrome, older devices won’t be updated making this a nice add-on at best.

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

#266

Earlier quoted context omitted.

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.

Why do you want something to happen everyday at 12 o'clock specifically? If this is truly what you want, sure.

Lunch break reminder popup?

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

#267

Temporal is a good idea, but the API is too complicated for broad adoption: - new Date() equivalent in Temporal is `const now = Temporal.Now.zonedDateTimeISO();`. - Date.now() equivalent is `Temporal.Now.instant().epochMilliseconds` - It’s PascalCase, where JS is mostly snakeCase. - nanoseconds per default. who needs that except Bloomberg? It should have been an option It’s definitely great all the efforts put in pla…

Most of that complication is there because times and dates are actually complicated. You can have a nice simple API that doesn't expose the complication only if you're happy for it to encourage false assumptions and wrong behaviour.

But, still, let's look at your first couple of complaints.

To make #1 more explicit: If you want the equivalent of "new Date()", then as you observe you need to say something that's longer because it's more specific about what it's giving you. Why can't it just do the obvious simple thing, like Date does?

To make #2 more explicit: If you want the equivalent of "Date.now()", then as you observe you again need to say something that's longer because it's more specific about what it's giving you. Why can't it just do the obvious simple thing, like Date does?

Well, because as those two examples show there isn't actually an obvious simple thing. Two operations both of which one might expect to do the obvious simple thing do different things, and if there's some obvious way for someone who doesn't already happen to have the specs of Date memorized to know which one is "new Date()" and which one is "Date.now()", I don't know what it is.

So, to me, those first two examples look like pretty convincing evidence that Temporal is a better design and one that's less likely to lead non-experts to make serious mistakes.

... And then your other two complaints aren't actually about the API being "too complicated" at all! PascalCase isn't more complicated than snakeCase. Nanoseconds aren't more complicated than milliseconds.

(Also: "zonedDateTimeISO" and "epochMilliseconds" are in fact both snakeCase, and a quick look at the Temporal documentation suggests that this is the norm. Method names are snakeCase, class names are PascalCase. I am not a Javascript expert but isn't that pretty normal?)

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

#268
post #267

Temporal is a good idea, but the API is too complicated for broad adoption: - new Date() equivalent in Temporal is `const now = Temporal.Now.zonedDateTimeISO();`. - Date.now() equivalent is `Temporal.Now.instant().epochMilliseconds` - It’s PascalCase, where JS is mostly snakeCase. - nanoseconds per default. who needs that except Bloomberg? It should have been an option It’s definitely great all the efforts put in pla…

Most of that complication is there because times and dates are actually complicated . You can have a nice simple API that doesn't expose the complication only if you're happy for it to encourage false assumptions and wrong behaviour. But, still, let's look at your first couple of complaints. To make #1 more explicit: If you want the equivalent of "new Date()", then as you observe you need to say something that's long…

Thanks for sharing your thoughts too. I still have the feeling that broad adoption comes from simple things that just work. And the complicated stuff is more optional.

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

#269

Earlier quoted context omitted.

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.

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

Only Morocco does this, I believe, and it's not even clear that that's actually official time at this point. In 2018, Morocco abolished DST, but it seems unclear what that means in practice.

I'd love it if someone from Morocco could weigh in on what the actual situation is on the ground. Do people still change their clocks for Ramadan? Would they be annoyed if a website kept Moroccan users on standard time during Ramadan?

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

#270
post #182

Earlier quoted context omitted.

So it's intentional to make people pass down raw strings versus making the communication safe(er) by default?

There are no date, time or datetime types in JSON, so you'll have to serialise it to a string or an int anyway, and then when deserialising you'll need to identify explicitly which values should be parsed as dates.

[deleted]
Post reply on HN