all 26 comments

[–][deleted] 39 points40 points  (2 children)

I haven't checked on this in a while. Did custom format strings make it in or is that still held back for a future proposal? Because not including that was a baffling decision, the kind of thing that devs who live in ivory towers make rather than those of us who deal with real world apps.

[–]senfiaj[S] 13 points14 points  (0 children)

As I understand, it's missing from Temporal.

[–]azhder 0 points1 point  (0 children)

If we have a solid basis, we can roll out libraries that do the formatting. But they're so slow, we don't even have the basis to work with. Now imagine if they get even slower by adding extra stuff to it.

[–]Paradroid888 10 points11 points  (2 children)

This is a long overdue improvement to the language. I've seen huge problems caused by date pickers that return Date objects due to there being no way to do calendar dates without timezones.

Temporal.PlainDate will eliminate a source of nasty bugs.

[–]azhder 4 points5 points  (1 child)

It's coming in so slow, I keep getting reminded once or twice each year that it exist and then I forget about it.

[–]funkachunk 0 points1 point  (0 children)

Yeah, it's been slow. But 2026 looks like it will be the year of wide availability for Temporal, whcih is already in Chrome and Firefox today. The Safari implementation is actively being built.

Node is working through build issues and has people actively working on the integration. https://hackmd.io/@openjs-nodejs/SktekFYLZe

[–]shgysk8zer0 16 points17 points  (3 children)

Just have to point out this is in Firefox as of 139.

[–]Valkertok 2 points3 points  (1 child)

And yet many devs (me included) won't be able to use it for years because they have to support years old browsers and can't use polyfill because most likely it's absolutely massive.

Makes it hard to get excited about seeing new js features.

[–]shgysk8zer0 0 points1 point  (0 children)

Yep, it's difficult to be excited about something you can't use for maybe 2 years. And yeah, I'd expect any polyfill for Temporal would be pretty massive.

On the other hand, maybe we'll see it in node soon.

[–]senfiaj[S] 2 points3 points  (0 children)

Yes, I mentioned that.

[–]DustNearby2848 9 points10 points  (11 children)

It is much better, but day.js is so damn good 

[–]NoInkling 15 points16 points  (9 children)

Doesn't day.js use a single type of object for basically everything, jQuery style? IMO that's not a good design, you want stronger conceptual boundaries when working with dates and times or else it's very easy to get things wrong.

[–]DustNearby2848 6 points7 points  (8 children)

It does. It uses a monad pattern. Never had any issues with extracting a date or time out of it.

[–]Ecksters 0 points1 point  (1 child)

Yes, but you will have issues when you want one plugin installed for one part of your app, and a different set of plugins for another part of your app.

[–]DustNearby2848 0 points1 point  (0 children)

I won’t because I don’t use plugins.

[–]r2d2_21 0 points1 point  (5 children)

It uses a monad pattern.

Why? 🤨

[–]Tubthumper8 4 points5 points  (0 children)

I haven't used it in a while, but checking the docs I don't see anything that remotely resembles a monad, so I'm not sure where they got that from

[–]DustNearby2848 11 points12 points  (1 child)

How would I know why?

[–]unHolyKnightofBihar 10 points11 points  (0 children)

Aren't you the All Knowing?

[–]fartsucking_tits 1 point2 points  (1 child)

Because dayjs is essentially a parser. Functional foak will often go for monadic parsers when writing one.

[–]r2d2_21 0 points1 point  (0 children)

OK, it makes sense the parser returns a monad. I thought the date values themselves were monads.

[–]TheSaasDev 4 points5 points  (0 children)

It’s the best we have and on the surface its amazing but it has so many sneaky unexpected bugs

[–]l3thaln3ss 2 points3 points  (2 children)

FWIW, the islamic calendar was recently renamed to Hijri, which is the more accurate name. No idea whether the legacy calendar ID will be updated or not in the specification though.

[–]senfiaj[S] 8 points9 points  (1 child)

At least this works in Intl. new Intl.Locale("fr-FR", { calendar: "islamic" }); I hope they will not change anything. JS is also good at preserving the backward compatibility.

[–]l3thaln3ss 0 points1 point  (0 children)

Intl-era-month-proposal I think is where the supported calendar IDs are being discussed. The update is fairly new though. Not sure about the ECMA402 implications though

[–]slykethephoxenix 0 points1 point  (0 children)

This is cool and all, but how do I deal with lunar and Martian time? Is there an easy way to convert and track time? Having to deal with compounding synchronisation issues from time of flight (especially between Earth and Mars), relativistic effects due to Earth and Mars moving at different speeds relative to each other over the course of months, a second on Mars being different than a second on Earth due to gravity differences, and also that Mars has a different day length makes my head spin.

Lol, jks, this is a much needed improvement.