garyb / purescript-codec-argonaut

Bi-directional JSON codecs for argonaut
MIT License
39 stars 16 forks source link

Prefered way to encode DateTime #40

Open wclr opened 3 years ago

wclr commented 3 years ago

How would you advise to work with DataTime from the core package and codecs, is the preferred way would be to convert it to Milliseconds using unInstant $ Instant.fromDate date and convert it back using Instant.toDateTime?

garyb commented 3 years ago

I'd say "it depends" - which is why this library doesn't provide codecs for the datetime library. If you're dealing with an external API that representation might not be suitable. If you don't care about the specifics of the representation then yeah, dimapping via Instant is probably the easiest definition.