Skip to content

Commit

Permalink
Merge pull request #7511 from NBKelly/work-around-anomalous-inst-beha…
Browse files Browse the repository at this point in the history
…viour

Check types match at runtime for time comparison
  • Loading branch information
NBKelly authored Jul 11, 2024
2 parents 256d37c + fff7fe8 commit e167095
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cljs/nr/game_row.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,13 @@
minutes))

(defn game-time [game]
(when (:started game)
[:div.game-time (str (time-since (:date game)) "m")]))
;; NOTE: while running locally (repl), the :date field ends up being
;; native code, rather than Instant type. I don't understand this,
;; but when running via uberjar (or after reloading web/lobby.clj)
;; it is of the correct type. IDK how to fix the problem, but this
;; is a workable temporary fix - NBKelly, Jul 2024
(when (and (:started game) (= (type (:date game)) (type (inst/now))))
[:div.game-time (str (time-since (:date game)) "m")]))

(defn players-row [{players :players :as game}]
(into
Expand Down

0 comments on commit e167095

Please sign in to comment.