mirror of
https://github.com/penpot/penpot.git
synced 2025-02-04 05:18:56 -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]
|
[d ta]
|
||||||
(.plus d ^TemporalAmount ta))
|
(.plus d ^TemporalAmount ta))
|
||||||
|
|
||||||
|
(defn minus
|
||||||
|
[d ta]
|
||||||
|
(.minus d ^TemporalAmount ta))
|
||||||
|
|
||||||
(defn- obj->duration
|
(defn- obj->duration
|
||||||
[{:keys [days minutes seconds hours nanos millis]}]
|
[{:keys [days minutes seconds hours nanos millis]}]
|
||||||
(cond-> (Duration/ofMillis (if (int? millis) ^long millis 0))
|
(cond-> (Duration/ofMillis (if (int? millis) ^long millis 0))
|
||||||
|
@ -81,6 +85,10 @@
|
||||||
[v]
|
[v]
|
||||||
(plus (now) (duration v)))
|
(plus (now) (duration v)))
|
||||||
|
|
||||||
|
(defn in-past
|
||||||
|
[v]
|
||||||
|
(minus (now) (duration v)))
|
||||||
|
|
||||||
(defn duration-between
|
(defn duration-between
|
||||||
[t1 t2]
|
[t1 t2]
|
||||||
(Duration/between t1 t2))
|
(Duration/between t1 t2))
|
||||||
|
|
Loading…
Add table
Reference in a new issue