8
you are viewing a single comment's thread
view the rest of the comments
[-] dan@upvote.au 6 points 1 month ago* (last edited 1 month ago)

It's a pretty good API. I recently built an appointment booking form and used Temporal for it. Thankfully, all the date logic is server-side (in server-side actions on an Astro site) so I didn't have to worry about browser compatibility.

I just have a few small nitpicks, but they're pretty easily fixable by using my own classes that extend the standard Temporal ones, or just standalone functions. Some examples:

  • I wish the classes like Date, DateTime, ZonedDateTime, etc had methods like isBefore and isAfter to compare to another instance. For some reason, I can never remember whether compare returning a negative number means the first argument is less than or greater than the second one. Maybe one day we'll get operator overloading.
  • I wish there was a way to set the default calendar. I had to manually pass calendar: 'gregory' in a bunch of places because I ended up hitting issues without it (one example). My code isn't running outside of areas that use the Gregorian calendar, so setting it as a default in my code would be ideal.

Node support was a bit rough in June/July so I ended up using the polyfill, but I think they've fixed all the major issues now.

this post was submitted on 02 Sep 2026
8 points (100.0% liked)

JavaScript

2830 readers
1 users here now

founded 3 years ago
MODERATORS