Skip to content

Commit 4b7e25b

Browse files
committed
Improve datetime cson test
1 parent 0e63257 commit 4b7e25b

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/portal/runtime/cson.cljc

+2-2
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,11 @@
353353
(json/push-string "inst")
354354
(json/push-long
355355
(inst-ms
356-
#?(:cljr (.UtcDateTime (System.DateTimeOffset. value)) :default value))))))
356+
#?(:cljr (.ToUniversalTime value) :default value))))))
357357

358358
(defn- ->inst [buffer]
359359
#?(:clj (Date. ^long (json/next-long buffer))
360-
:cljr (.DateTime
360+
:cljr (.UtcDateTime
361361
(System.DateTimeOffset/FromUnixTimeMilliseconds
362362
(json/next-long buffer)))
363363
:cljs (js/Date. (json/next-long buffer))))

test/portal/runtime/cson_test.cljc

+2-4
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@
125125
(is (= (seq a) (seq b)))))
126126

127127
(def tagged
128-
[#?(:clj (Date.)
129-
:cljr (DateTime/Now)
130-
:cljs (js/Date.))
128+
[#inst "2021-04-07T22:43:59.393-00:00"
131129
#?(:clj (UUID/randomUUID)
132130
:cljr (Guid/NewGuid)
133131
:cljs (random-uuid))
@@ -136,7 +134,7 @@
136134

137135
(deftest tagged-objects
138136
(doseq [value tagged]
139-
(is (= (pass value) (pass value)))))
137+
(is (= value (pass value)))))
140138

141139
(defn meta* [v]
142140
#?(:bb (dissoc (meta v) :type) :cljr (meta v) :clj (meta v) :cljs (meta v)))

0 commit comments

Comments
 (0)