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

**URL:** https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344
**Category:** Blogs
**Created:** [January 10, 2020, 10:38am UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344 "2020-01-10T10:38:30Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![henry\_w](https://clojureverse.org/user_avatar/clojureverse.org/henry_w/32/1342_2.png) [@henry\_w](https://clojureverse.org/u/henry_w)
#### Post date: [January 10, 2020, 10:38am UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/1 "2020-01-10T10:38:30Z")

</div>

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

> **[Progress update on the Clojure(Script) date-time libraries](http://widdindustries.com/clojure-time-libs-update/)**
>
> In April 2019 I gave a talk at Clojure/North providing my motivation for working on new date-time libraries: cljc.java-time, time-literals and tick. Yes, you heard right, yet more date-time libraries! In the talk I argue that they provide novelty...

AMA here, thanks

---

<div class="post-metadata">

### Author: ![borkdude](https://clojureverse.org/user_avatar/clojureverse.org/borkdude/32/306_2.png) [@borkdude](https://clojureverse.org/u/borkdude)
#### Post date: [January 10, 2020, 11:19am UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/2 "2020-01-10T11:19:14Z")

</div>

Thanks for the overview.

I’ve added most java.time classes to [babashka](https://github.com/borkdude/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:

```auto
$ 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

```

---

<div class="post-metadata">

### Author: ![henry\_w](https://clojureverse.org/user_avatar/clojureverse.org/henry_w/32/1342_2.png) [@henry\_w](https://clojureverse.org/u/henry_w)
#### Post date: [January 10, 2020, 12:47pm UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/3 "2020-01-10T12:47:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![henry\_w](https://clojureverse.org/user_avatar/clojureverse.org/henry_w/32/1342_2.png) [@henry\_w](https://clojureverse.org/u/henry_w)
#### Post date: [May 29, 2020, 8:06am UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/4 "2020-05-29T08:06:25Z")

</div>

I think cljc.java-time will work on babashka with a few tweaks: I raised this issue [https://github.com/henryw374/cljc.java-time/issues/10](https://github.com/henryw374/cljc.java-time/issues/10)

---

<div class="post-metadata">

### Author: ![henry\_w](https://clojureverse.org/user_avatar/clojureverse.org/henry_w/32/1342_2.png) [@henry\_w](https://clojureverse.org/u/henry_w)
#### Post date: [May 29, 2020, 4:41pm UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/5 "2020-05-29T16:41:28Z")

</div>

the few tweaks have been made! version 0.1.11 (on clojars [https://clojars.org/cljc.java-time](https://clojars.org/cljc.java-time)) now works on babashka

```auto
user=> (require '[cljc.java-time.zone-id :as z])
user=> (z/of "America/Los_Angeles")
#object[java.time.ZoneRegion 0x4d87cb0a "America/Los_Angeles"]
user=> (require '[cljc.java-time.local-date :as ld])
user=> (ld/now)
#object[java.time.LocalDate 0x4045d556 "2020-05-29"]

```

---

<div class="post-metadata">

### Author: ![ikitommi](https://clojureverse.org/user_avatar/clojureverse.org/ikitommi/32/5797_2.png) [@ikitommi](https://clojureverse.org/u/ikitommi)
#### Post date: [September 21, 2020, 4:49pm UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/6 "2020-09-21T16:49:40Z")

</div>

Any update on the time-libraries? Would need [a light weight time abstraction for malli](https://github.com/metosin/malli/issues/49), supporting Clojure/Script. Something small and simple, compatible with `java.time`. Could be just a standalone `malli.time` namespace, but could be a 3rd party lib, if such exists. In JSON Schema, there are only `date-time`, `date` and `time`.

Requirements:

- basic types (java.time & ??? for cljs)
- type and range validation
- parsing from strings (+ formats)
- small js bundle size

---

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [September 21, 2020, 7:48pm UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/7 "2020-09-21T19:48:24Z")

</div>

Is [tick](https://github.com/juxt/tick) too big? It’s our favorite on our projects.

---

<div class="post-metadata">

### Author: ![ikitommi](https://clojureverse.org/user_avatar/clojureverse.org/ikitommi/32/5797_2.png) [@ikitommi](https://clojureverse.org/u/ikitommi)
#### Post date: [September 22, 2020, 8:03am UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/8 "2020-09-22T08:03:30Z")

</div>

Tick is awesome, and light on the JVM but sadly, it uses [js-joda](https://github.com/js-joda/js-joda) with cljs, which is too big as a library dependency. Malli is built DCE in mind, the bundle sizes start from few kilos gzipped. js-joda is 43kb, tick totals 50kb.

here’s a sample report using shadow-cljs:

 ![Screenshot 2020-09-22 at 10.57.21](https://clojureverse.org/uploads/default/original/2X/1/10d87e8bfc05c4a9e7b481757276ac4a41fd547d.png)

If there is way to slim down tick on cljs, I’m all 👂s

---

<div class="post-metadata">

### Author: ![henry\_w](https://clojureverse.org/user_avatar/clojureverse.org/henry_w/32/1342_2.png) [@henry\_w](https://clojureverse.org/u/henry_w)
#### Post date: [September 22, 2020, 8:21am UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/9 "2020-09-22T08:21:43Z")

</div>

Ok so I have a work in progress which means DCE will work for js-joda - see [Cljc.java-time will drop all npm/foreign-lib dependencies](https://v2.clojureverse.org/t/cljc-java-time-will-drop-all-npm-foreign-lib-dependencies/6208). It’s taken ages, but all the bits are there - I just need to finish it off… which I’ll try to do in the next couple of weeks or so.

So to be clear, although DCE works on it, (so if you don’t use any of the lib, nothing gets included in your js bundle) - because of the nature of the library, if an end user does use some of jsjoda, they end up pulling in most of the lib. It’s just the nature of js-joda that it’s a bit like a ball of string - ie start pulling on one bit and the rest follows. So not the best outcome I could have hoped for.

Longer term, the new platform dates for JS should be a good solution - in that cljc.java-time could use that and be dependency free - see [https://github.com/henryw374/cljc.java-time/wiki](https://github.com/henryw374/cljc.java-time/wiki) for some thoughts on that, including the fact that the api is not completely 1:1 with java.time.

---

<div class="post-metadata">

### Author: ![Webdev\_Tory](https://clojureverse.org/user_avatar/clojureverse.org/webdev_tory/32/3781_2.png) [@Webdev\_Tory](https://clojureverse.org/u/Webdev_Tory)
#### Post date: [September 22, 2020, 1:19pm UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/10 "2020-09-22T13:19:49Z")

</div>

How did you make this bundle size report? I’ve been wanting to do that!

---

<div class="post-metadata">

### Author: ![orestis](https://clojureverse.org/user_avatar/clojureverse.org/orestis/32/279_2.png) [@orestis](https://clojureverse.org/u/orestis)
#### Post date: [September 22, 2020, 1:50pm UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/11 "2020-09-22T13:50:33Z")

</div>

That’s a standard shadow-cljs thing: [https://shadow-cljs.github.io/docs/UsersGuide.html#\_build\_report](https://shadow-cljs.github.io/docs/UsersGuide.html#_build_report)

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [March 24, 2021, 1:50am UTC](https://clojureverse.org/t/progress-update-on-the-clojure-script-date-time-libraries/5344/12 "2021-03-24T01:50:41Z")

</div>

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
