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:
parent
2145130d21
commit
2456b82e65
1 changed files with 8 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue