by FrontAid · 4y ago · 0 comments
- https://github.com/tc39/proposal-temporal
- https://github.com/tc39/proposal-temporal#polyfills
- https://tc39.es/proposal-temporal/
- https://tc39.es/proposal-temporal/docs/index.html
- https://github.com/tc39/proposal-temporal/issues/1450
- https://tc39.es/proposal-temporal/docs/parse-draft.html
As far as I know, issue #1450 is the last remaining blocker for the standardization. I'd assume that this will be resolved in the next months. So Temporal will likely be officially released with ECMAScript 2023, but browser vendors and other implementors will start shipping it before the offical release.
The fact that it only took me a few hours to find these suggests there are plenty more bugs like these to find. The fact that these bugs have been open since the start of March with no movement on them suggests they aren’t too interested in correct behaviour (or perhaps they’re just your typical under-staffed open source project).
Maybe I just got super unlucky and ran into the only two bugs here… but it’s not likely.
Luxon and moment.js both handled these cases perfectly. If you’re looking to move from whatever you’re using now, and you can’t wait for the new standard, I’d pick one of those.
Also, once the spec is finalized, there may also be a compliant polyfill available. If so, you'll get the functionality early and still have good compatibility down the line.
Or as it is coming RealSoonNow(tm) perhaps start looking into polyfills as you are going to need one anyway for a story time at least to support LTS browser versions.
you don't need to hold off - you just wrap the library in an api of your own, specific for your usage. Then, when/if the ecmascript standard library adds a good one in, you just need to re-implement the wrapper, which would be presumably pretty easy as the api surface area is fairly small.
Right from the beginning, I told anyone who would listen that the underlying data was in UTC. So far, so good.
They get to T-24h for the client's Big Demo Day...
...and someone in London, UK notices the front end UI times are all an hour out (that would be because the UK is still on summer time, UTC+1). I happened to be in Germany and after finally being given a login for the UI found that, wonder of wonders, the timings were two hours out!
<groan>
So we had to bodge the API to fiddle the times forward to UTC+1 for the purposes of the damned demo.
Someone is presumably going to find this in the repo waaaay in the future and ask themselves "wtf were they thinking?". I wish I knew the answer.
const firstInMonth = Temporal.Now.with({ day: 1 }); Temporal.Now.plainDateISO().with({ day: 1 })
Today (2022-10-10 on my computer), that’ll get you a PlainDate representing 2022-10-01.The “ISO” in there identifies the calendar. Want to know what the first of the current month in the Hebrew calendar is?
Temporal.Now.plainDate("hebrew").with({ day: 1 })
And that gives you 2022-09-26[u-ca=hebrew].By then you can assume that the other library will be a lightweight wrapper around Temporal.
I just think it was needlessly assertive to say nobody should migrate their datetime library until it's ready