0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

🎉 Add helpers for create datetimes in the past.

This commit is contained in:
Andrey Antukh 2021-01-31 11:52:00 +01:00 committed by Alonso Torres
parent 2145130d21
commit 2456b82e65

View file

@ -45,6 +45,10 @@
[d ta]
(.plus d ^TemporalAmount ta))
(defn minus
[d ta]
(.minus d ^TemporalAmount ta))
(defn- obj->duration
[{:keys [days minutes seconds hours nanos millis]}]
(cond-> (Duration/ofMillis (if (int? millis) ^long millis 0))
@ -81,6 +85,10 @@
[v]
(plus (now) (duration v)))
(defn in-past
[v]
(minus (now) (duration v)))
(defn duration-between
[t1 t2]
(Duration/between t1 t2))