got something going :
(deftype DateHandler []
Object
(tag [_ v] "time/date")
(rep [_ v] (with-out-str (print v)))
(stringRep [_ v] nil))
(def date-reader (t/reader :json {:handlers {"time/date" #(cljs.reader/read-string %)}}))
(def date-writer (t/writer :json {:handlers {tutil/Date (DateHandler.)}}))
(t/read date-reader (t/write date-writer (ti/today)))
(def Date (type (t/date)))
(def DateTime (type (t/date-time)))
(def Time (type (t/time)))
(def Period (type (t/new-period 1 :days)))
(def Duration (type (t/new-duration 1 :seconds)))
(def Instant (type (t/instant)))
(deftype TickHandler []
Object
(tag [_ v] "time/tick")
(rep [_ v] (with-out-str (print v)))
(stringRep [_ v] nil))
(def tick-handler (TickHandler.))
(def tick-handler-map
(into {}
(map #(vector (first %) (second %))
(partition 2
(interleave
[Date DateTime Time Period Duration Instant]
(repeat tick-handler))))))
this is working for the clojurescript sidegot round trip working 😄
(:require
#?(:cljs [cljs.reader]
:clj [clojure.edn])
[time-literals.read-write :as rw]
[cognitect.transit :as tr]
[tick.alpha.api :as t])
(def transit-tag "time/tick")
#?(:cljs (deftype TickHandler []
Object
(tag [_ v] transit-tag)
(rep [_ v] (with-out-str (pr v)))
(stringRep [_ v] nil)))
(def tick-transit-write-handler
#?(:cljs (TickHandler.)
:clj (tr/write-handler
transit-tag
(fn [v] (with-out-str (pr v))))))
(def tick-transit-writer-handler-map
(reduce
(fn [m [k v]] (assoc m k v))
{}
(partition 2
(interleave
[Date DateTime Time Period Duration Instant]
(repeat tick-transit-write-handler)))))
(def tick-transit-reader
{transit-tag
#?(:cljs cljs.reader/read-string
:clj (tr/read-handler #(clojure.edn/read-string {:readers rw/tags} %)))})