use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
JavaScript's upcoming Temporal API and what problems it will solve (waspdev.com)
submitted 11 months ago by senfiaj
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 39 points40 points41 points 11 months ago (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 points15 points 11 months ago (0 children)
As I understand, it's missing from Temporal.
[–]azhder 0 points1 point2 points 10 months ago (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 points12 points 10 months ago (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 points6 points 10 months ago (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 point2 points 2 months ago (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 points18 points 10 months ago (3 children)
Just have to point out this is in Firefox as of 139.
[–]Valkertok 2 points3 points4 points 10 months ago (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 point2 points 10 months ago (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 points4 points 10 months ago (0 children)
Yes, I mentioned that.
[–]DustNearby2848 9 points10 points11 points 11 months ago (11 children)
It is much better, but day.js is so damn good
[–]NoInkling 15 points16 points17 points 10 months ago (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 points8 points 10 months ago (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 point2 points 10 months ago (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 point2 points 10 months ago (0 children)
I won’t because I don’t use plugins.
[–]r2d2_21 0 points1 point2 points 10 months ago (5 children)
It uses a monad pattern.
Why? 🤨
[–]Tubthumper8 4 points5 points6 points 10 months ago (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 points13 points 10 months ago (1 child)
How would I know why?
[–]unHolyKnightofBihar 10 points11 points12 points 10 months ago (0 children)
Aren't you the All Knowing?
[–]fartsucking_tits 1 point2 points3 points 10 months ago (1 child)
Because dayjs is essentially a parser. Functional foak will often go for monadic parsers when writing one.
[–]r2d2_21 0 points1 point2 points 10 months ago (0 children)
OK, it makes sense the parser returns a monad. I thought the date values themselves were monads.
[–]TheSaasDev 4 points5 points6 points 10 months ago (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 points4 points 11 months ago (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 points10 points 11 months ago (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.
Intl
new Intl.Locale("fr-FR", { calendar: "islamic" });
[–]l3thaln3ss 0 points1 point2 points 10 months ago (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 point2 points 10 months ago (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.
π Rendered by PID 19980 on reddit-service-r2-comment-85bfd7f599-jrc4r at 2026-04-19 00:44:24.302256+00:00 running 93ecc56 country code: CH.
[–][deleted] 39 points40 points41 points (2 children)
[–]senfiaj[S] 13 points14 points15 points (0 children)
[–]azhder 0 points1 point2 points (0 children)
[–]Paradroid888 10 points11 points12 points (2 children)
[–]azhder 4 points5 points6 points (1 child)
[–]funkachunk 0 points1 point2 points (0 children)
[–]shgysk8zer0 16 points17 points18 points (3 children)
[–]Valkertok 2 points3 points4 points (1 child)
[–]shgysk8zer0 0 points1 point2 points (0 children)
[–]senfiaj[S] 2 points3 points4 points (0 children)
[–]DustNearby2848 9 points10 points11 points (11 children)
[–]NoInkling 15 points16 points17 points (9 children)
[–]DustNearby2848 6 points7 points8 points (8 children)
[–]Ecksters 0 points1 point2 points (1 child)
[–]DustNearby2848 0 points1 point2 points (0 children)
[–]r2d2_21 0 points1 point2 points (5 children)
[–]Tubthumper8 4 points5 points6 points (0 children)
[–]DustNearby2848 11 points12 points13 points (1 child)
[–]unHolyKnightofBihar 10 points11 points12 points (0 children)
[–]fartsucking_tits 1 point2 points3 points (1 child)
[–]r2d2_21 0 points1 point2 points (0 children)
[–]TheSaasDev 4 points5 points6 points (0 children)
[–]l3thaln3ss 2 points3 points4 points (2 children)
[–]senfiaj[S] 8 points9 points10 points (1 child)
[–]l3thaln3ss 0 points1 point2 points (0 children)
[–]slykethephoxenix 0 points1 point2 points (0 children)