Closed saevarb closed 3 years ago
I just realized I managed to post this in the wrong repository. This is particularly stupid of me because I realized I was about to do this half way through writing the issue, opened up the io-ts-types repository instead, copied the bug report over but somehow still finished it in this tab.
Should I close this and post this there or is there something a maintainer can do that is easier?
I think we should wrap the encoded value in Math.floor
:
-a => a.getTime() / 1000
+a => Math.floor(a.getTime() / 1000)
🐛 Bug report
Current Behavior
DateFromUnixTime.encode returns a floating point number which its decoder refuses to accept.
Expected behavior
DateFromUnixTime.encode returns an integer so that
decode(encode(x)) = x
.Reproducible example
Your environment