Created
April 25, 2016 12:58
-
-
Save arjan/61bfaedc7efda2482f51df7e41e4d032 to your computer and use it in GitHub Desktop.
Serialize Timex.DateTime to JSON automatically
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defimpl Poison.Encoder, for: Timex.DateTime do | |
use Timex | |
def encode(d, _options) do | |
fmt = DateFormat.format!(d, "{ISO}") | |
"\"#{fmt}\"" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment