-
Notifications
You must be signed in to change notification settings - Fork 47
Closed
Labels
Description
I have a nested data structure and I want to convert all the date time objects in it to ISO8601 timestamps during serialization. So, I need to find out what the timestamps are. I can't just try converting with instant, because it'll try to convert strings, which I don't want.
inst? is almost what I want, but Joda Time instances don't satisfy Inst. This could be solved with something along the lines of the following:
(try
(Class/forName "org.joda.time.Instant")
(eval
'(extend-protocol Inst
org.joda.time.Instant
(inst-ms* [inst] (inst-ms* (jt/instant inst)))
org.joda.time.DateTime
(inst-ms* [inst] (inst-ms* (jt/instant inst)))))
(catch ClassNotFoundException cnfe))(though this project already has a better when-joda macro :))
Do you have a preferred solution?