6 ms·
Temporal is great, and the sooner it lands and is usable the better (AFAIK, there isn't a production-grade polyfill yet.) In the interim, JS-Joda [0] seems pre
by dragonwriter 5y ago
Temporal is great, and the sooner it lands and is usable the better (AFAIK, there isn't a production-grade polyfill yet.)
In the interim, JS-Joda [0] seems pretty decent, and doesn't use the wrapper approach.
[0] https://js-joda.github.io/js-joda/ https://js-joda.github.io/js-joda/
- aidos 5y agoI’ve been keeping an eye on it myself. The implementation in Chrome looks pretty complete already, which is promising. I don’t quite get the point of the other libraries like moment etc. They have a bunch of convenience stuff, but unless you’ve modelled the different types of times that crop up in real life, it’s all a bit pointless. When I first read through the Temporal api, I was physically nodding along in agreement. It’s dates and times done right in js. Can’t wait to be able to use it.
- httgp 5y agoMy favorite has always been Day.js [0] - it is really small, has a very clean API, great documentation and does pretty much everything I want. [0] https://day.js.org/ https://day.js.org/
- aidos 5y agoIt’s not really the same thing though, right? It doesn’t handle instants vs zonedtimes etc. Even the simplest of future cases is handled poorly by these other libraries. If you want to say that something happens on a certain date in the future (say, a due date), your only option is to use an instant as an approximation (often midnight utc on that day). It works ok, but you’re better to have a proper datatype that represents a day without a time and timezone component (it’s effectively a 50hr ish window). Temporal gives you all that and more.
- moogly 5y agoUsed that as a replacement for momentjs until we had to make things seriously timezone-aware, and some quite crippling tz bugs (granted, probably 2 years ago now) made us move to Luxon. That worked well, but I'm glad to have something JodaTime-ish coming now that doesn't conflate instants with zoned datetimes with durations.