aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/tau
diff options
context:
space:
mode:
authorMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-30 21:30:41 +0100
committerMiguel Ángel Moreno <mail@migalmoreno.com>2022-12-30 21:30:41 +0100
commit4ae38a587c9cd48f6c7b34777f81304011959d1b (patch)
tree3bb6d2985695ce3376f210a1ed2583310d42feb6 /src/frontend/tau
parent7875ccb4b297c5f05d1d14376937433a85a66533 (diff)
feat(frontend): Add date formatting helper
Diffstat (limited to 'src/frontend/tau')
-rw-r--r--src/frontend/tau/util.cljs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/frontend/tau/util.cljs b/src/frontend/tau/util.cljs
index 1a3e243..d23ef9a 100644
--- a/src/frontend/tau/util.cljs
+++ b/src/frontend/tau/util.cljs
@@ -1,4 +1,12 @@
-(ns tau.util)
+(ns tau.util
+ (:require
+ ["timeago.js" :as timeago]))
+
+(defn format-date
+ [date]
+ (if (-> date js/Date.parse js/isNaN)
+ date
+ (timeago/format date)))
(defn format-quantity
[num]