File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 4
4
[clj-commons.humanize.inflect :refer [pluralize-noun in?]]
5
5
[clj-commons.humanize.time-convert :refer [coerce-to-local-date-time]]
6
6
[cljc.java-time.duration :as jt.duration]
7
+ [cljc.java-time.extn.predicates :as jt.predicates]
7
8
[cljc.java-time.local-date-time :as jt.ldt]
8
9
[clojure.string :as string :refer [join]]
9
10
#?@(:cljs [[goog.string :as gstring]
292
293
:or {now-dt (jt.ldt/now )
293
294
suffix " ago"
294
295
prefix " in" }}]
295
- (let [then-dt (coerce-to-local-date-time then-dt)
296
+ (let [local-date? (jt.predicates/local-date? then-dt)
297
+ then-dt (coerce-to-local-date-time then-dt)
296
298
now-dt (coerce-to-local-date-time now-dt)
299
+ now-dt (if local-date?
300
+ (-> now-dt
301
+ (jt.ldt/with-hour 0 )
302
+ (jt.ldt/with-minute 0 )
303
+ (jt.ldt/with-second 0 )
304
+ (jt.ldt/with-nano 0 ))
305
+ now-dt)
297
306
future-time? (jt.ldt/is-after then-dt now-dt)
298
307
; ; get the Duration between the two times
299
308
time-between (-> (jt.duration/between then-dt now-dt)
342
351
future-time?
343
352
(str prefix " a moment" )
344
353
354
+ local-date?
355
+ " today"
356
+
345
357
:else
346
358
(str " a moment " suffix))))
347
359
You can’t perform that action at this time.
0 commit comments