Progress update on the Clojure(Script) date-time libraries

An update on what’s happened since I gave a talk last April.

AMA here, thanks

3 Likes

Thanks for the overview.

I’ve added most java.time classes to babashka, since I couldn’t figure out what the date-time library should be to provide as a built-in. But now that it supports libraries via the --classpath option, such a library could be made in user-space.

Short demo:

$ pst.clj
#!/usr/bin/env bb

(def now (java.time.ZonedDateTime/now))
(def LA-timezone (java.time.ZoneId/of "America/Los_Angeles"))
(def LA-time (.withZoneSameInstant now LA-timezone))
(def pattern (java.time.format.DateTimeFormatter/ofPattern "HH:mm"))
(println (.format LA-time pattern))

$ pst.clj
03:17
1 Like

Sounds interesting, I’ve been meaning to have a look at Babashka