0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 08:20:45 -05:00

Allow floats on db/interval constructor

This commit is contained in:
Andrey Antukh 2022-09-20 21:15:57 +02:00
parent ef2918a115
commit d3347a1be0

View file

@ -367,23 +367,23 @@
(.rollback conn sp)))
(defn interval
[data]
[o]
(cond
(integer? data)
(->> (/ data 1000.0)
(or (integer? o)
(float? o))
(->> (/ o 1000.0)
(format "%s seconds")
(pginterval))
(string? data)
(pginterval data)
(string? o)
(pginterval o)
(dt/duration? data)
(->> (/ (.toMillis ^java.time.Duration data) 1000.0)
(format "%s seconds")
(pginterval))
(dt/duration? o)
(interval (inst-ms o))
:else
(ex/raise :type :not-implemented)))
(ex/raise :type :not-implemented
:hint (format "no implementation found for value %s" (pr-str o)))))
(defn decode-json-pgobject
[^PGobject o]