5 ms·
Java 8 Date/Time API is surprisingly nice. I think that every language should just copy it. It's comprehensive and easy to use.
by vbezhenar 5y ago
Java 8 Date/Time API is surprisingly nice. I think that every language should just copy it. It's comprehensive and easy to use.
- twic 5y agoJava 8's time package is a sort of second version of Joda-Time by Stephen Colebourne, who is not very impressed by the new JavaScript API: https://twitter.com/jodastephen/status/1393146501073973248 https://twitter.com/jodastephen/status/1393146501073973248 He has opened a few issues along the way, trying to help TC39 learn from Joda's experience, with varying results: https://github.com/tc39/proposal-temporal/issues?q=is%3Aissue+author%3A%22jodastephen%22 https://github.com/tc39/proposal-temporal/issues?q=is%3Aissu...
- topspin 5y agoHard won lessons have to be relearned over and over in software.
- nobleach 5y agoAnd those of us who used Joda-Time were so pleased when it became almost a "built-in" in Java 8.
- lifthrasiir 5y agoOh, so the embedded calendar system in Joda-Time is a mistake. I too disliked that choice and wondered if it only exists for localization uses (but then I'd like to have a separate set of "display" classes), and well, he knew (or came to know) it. I'm relieved now.
- Vinnl 5y agoDamn, he says [1]: > Sorry to be blunt, but the current approach really is a terrible one. That is blunt, and would require my utmost restraint to avoid falling into the trap of getting overly defensive if I were the proposal authors. Which is a shame, because he makes a good point. That said, it is also reassuring to see that they did actually consider his point, and I can follow their motivation [2]. I'm not sure whether I'd have made the same decision, but it's certainly a valid one to make. [1] https://github.com/tc39/proposal-temporal/issues/1454 https://github.com/tc39/proposal-temporal/issues/1454 [2] https://tc39.es/proposal-temporal/docs/calendar-review#why-are-calendars-a-higher-priority-for-ecmascript-vs-other-platforms https://tc39.es/proposal-temporal/docs/calendar-review#why-a...
- ape4 5y agoYeah is every language going to have a big date/time API. Temporal looks good but its big.
- asciimov 5y agoCareful, Oracle is likely to sue you for copying their API.
- bluedevil2k 5y agoThey already have that for JS! https://js-joda.github.io/js-joda/ https://js-joda.github.io/js-joda/
- slaymaker1907 5y agoI always use java.time.* for doing any sort of date arithmetic like how many days are between two days or when is 20 days after some date. jshell makes it really easy to use, just do "import java.time.*".
- henryw374 5y agoFyi comparison of java.time to Temporal https://widdindustries.com/ecma-temporal-vs-java-time/ https://widdindustries.com/ecma-temporal-vs-java-time/