File tree 11 files changed +75
-61
lines changed
11 files changed +75
-61
lines changed Original file line number Diff line number Diff line change
1
+
2
+ cljs
3
+ [ "~ #zoned-date-time","2024-10-11T18:36:31.396-05:00[ SYSTEM] "]
4
+
5
+ clj
6
+ [ "~ #zoned-date-time","2024-10-11T18:35:15.154763401-05:00[ America/Panama] "]
7
+
8
+
9
+
10
+ problem is that browser has no timezones, so we cannot send them.
Original file line number Diff line number Diff line change
1
+ (ns demo.tick
2
+ (:require
3
+ [cljc.java-time.zone-id :refer [get-available-zone-ids]]
4
+ )
5
+ )
6
+
7
+
8
+
9
+ (get-available-zone-ids )
10
+ ; ; => #{"Asia/Aden" "America/Cuiaba" "Etc/GMT+9" "Etc/GMT+8" "Africa/Nairobi"
11
+ ; ; "America/Marigot" "Asia/Aqtau" "Pacific/Kwajalein" "America/El_Salvador" "Asia/Pontianak"
12
+ ; ; "Africa/Cairo" "Pacific/Pago_Pago" "Africa/Mbabane" "Asia/Kuching" "Pacific/Honolulu" "Pacific/Rarotonga"
13
+ ; ; "America/Guatemala" "Australia/Hobart" "Europe/London" "America/Belize" "America/Panama" "Asia/Chungking" "America/Managua" "America/Indiana/Petersburg" "Asia/Yerevan" "Europe/Brussels" "GMT" "Europe/Warsaw" "America/Chicago" "Asia/Kashgar" "Chile/Continental" "Pacific/Yap" "CET" "Etc/GMT-1" "Etc/GMT-0" "Europe/Jersey" "America/Tegucigalpa" "Etc/GMT-5" "Europe/Istanbul" "America/Eirunepe" "Etc/GMT-4" "America/Miquelon" "Etc/GMT-3" "Europe/Luxembourg" "Etc/GMT-2" "Etc/GMT-9" "America/Argentina/Catamarca" "Etc/GMT-8" "Etc/GMT-7" "Etc/GMT-6" ...}
14
+
Original file line number Diff line number Diff line change 20
20
; encoding edn/transit/json
21
21
com.cognitect/transit-clj {:mvn/version " 1.0.333" } ; transit
22
22
com.cognitect/transit-cljs {:mvn/version " 0.8.280" } ; transit
23
- fipp/fipp {:mvn/version " 0.6.25" } ; edn pretty printing
24
- cheshire/cheshire {:mvn/version " 5.10.2" } ; JSON parsings and pretty printing
23
+ fipp/fipp {:mvn/version " 0.6.26" } ; edn pretty printing
25
24
; time encoding
26
25
tick/tick {:mvn/version " 0.6.2" } ; replacement for clj-time
27
26
; 20240917 removed dep to clojure.java-time. we only use tick really
28
27
; clojure.java-time/clojure.java-time {:mvn/version "0.3.3"} this caused clojure errors.
29
- com.andrewmcveigh/cljs-time {:mvn/version " 0.5.2" }
28
+ ; com.andrewmcveigh/cljs-time {:mvn/version "0.5.2"}
30
29
com.widdindustries/time-literals {:mvn/version " 0.1.10" } ; also used by tick
31
30
; image encoding
32
31
org.clojure/data.codec {:mvn/version " 0.1.1" } ; image base64 encoding
File renamed without changes.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
(ns modular.encoding.edn-test
2
2
(:require
3
3
[clojure.test :refer [deftest is testing]]
4
- [modular.encoding.edn :refer [spit-edn slurp-edn]]
4
+ [modular.encoding.edn :refer [spit-edn slurp-edn read-edn]]
5
+ [modular.persist.edn :refer [pprint-str]]
5
6
[modular.encoding.demo-data :refer [demo-data]]))
6
7
7
8
(def filename " /tmp/edn-test.edn" )
10
11
(spit-edn filename demo-data)
11
12
(is (= demo-data (slurp-edn filename))))
12
13
13
-
14
+ (deftest localdate-reload-test
15
+ (let [sdate (str " #time/date \" 2011-01-01\" " " \n " )
16
+ stime (str " #time/date-time \" 2021-11-04T00:52:59.694154533\" " " \n " )]
17
+ (is (= sdate (-> sdate read-edn pprint-str)))
18
+ (is (= stime (-> stime read-edn pprint-str)))))
Original file line number Diff line number Diff line change 1
1
(ns modular.encoding.transit-test
2
2
(:require
3
3
[clojure.test :refer [deftest is testing]]
4
- [modular.encoding.transit :refer [spit-transit slurp-transit]]
4
+ [tick.core :as t]
5
+ [modular.encoding.transit :refer [spit-transit slurp-transit write-transit read-transit]]
5
6
[modular.encoding.demo-data :refer [demo-data]]))
6
7
7
8
(def filename " /tmp/transit-test.json" )
11
12
(is (= demo-data (slurp-transit filename)))
12
13
13
14
;
14
- )
15
+ )
16
+
17
+ (deftest encoding-transit-zoned-test []
18
+ (let [data (t/zoned-date-time )
19
+ t (write-transit data)]
20
+ (println " transit encoded: " t)
21
+ (is (= data (read-transit t)))))
22
+
23
+ (deftest decoding-transit-zoned-test []
24
+ (let [json " [\" ~#zoned-date-time\" ,\" 2024-10-11T18:35:15.154763401-05:00[America/Panama]\" ]"
25
+ dt (read-transit json)
26
+ json2 (write-transit dt)]
27
+ (is (= json json2))))
28
+
29
+ #_(deftest decoding-transit-zoned2-test []
30
+ (let [json " [\" ~#zoned-date-time\" ,\" 2024-10-11T18:36:31.396-05:00[SYSTEM]\" ]"
31
+ dt (read-transit json)
32
+ json2 (write-transit dt)]
33
+ (is (= json json2))))
34
+
35
+ ; '2024-10-11T18:36:31.396-05:00[SYSTEM]' could not be parsed, unparsed text found at index 29
36
+
37
+ (deftest decoding-transit-zoned2-test []
38
+ (let [json " [\" ~#zoned-date-time\" ,\" 2024-10-11T18:36:31.396-05:00[America/Panama]\" ]"
39
+ dt (read-transit json)
40
+ json2 (write-transit dt)]
41
+ (is (= json json2))))
Original file line number Diff line number Diff line change 1
1
(ns modular.encoding.transit-test
2
2
(:require
3
3
[cljs.test :refer-macros [async deftest is testing]]
4
+ [cljc.java-time.zone-id :refer [get-available-zone-ids]]
5
+ [tick.core :as t]
4
6
[bidi.bidi :as bidi]
5
7
[modular.encoding.transit :refer [write-transit read-transit]]
6
8
[modular.encoding.edn :refer [read-edn]]
16
18
(deftest encoding-transit-simple-test []
17
19
(let [data (dissoc demo-data :date :bidi )
18
20
t (write-transit data)]
21
+ (println " transit encoded: " t)
19
22
(is (= data (read-transit t)))))
20
23
21
24
(deftest encoding-transit-date-test []
22
25
(let [data (dissoc demo-data :bidi )
23
26
t (write-transit data)]
27
+ (println " transit encoded: " t)
28
+ (is (= data (read-transit t)))))
29
+
30
+ (deftest encoding-transit-zoned-test []
31
+ (let [data (t/zoned-date-time )
32
+ t (write-transit data)]
33
+ (println " transit encoded: " t)
24
34
(is (= data (read-transit t)))))
25
35
26
36
#_(deftest encoding-transit-bidi-test []
27
37
(let [t (write-transit demo-data)]
28
38
(is (= demo-data (read-transit t)))))
29
39
40
+ (println " available timezones in cljs: "
41
+ (get-available-zone-ids ))
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3
3
[clojure.test :refer [deftest is]]
4
4
[modular.file.explore :as filesystem]
5
5
[modular.resource.explore :as resource]
6
- [modular.test-init] ; side effects
6
+ ; [modular.test-init] ; side effects
7
7
))
8
8
(defn without-path [l]
9
9
(map #(dissoc % :path ) l))
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments