As the title reads, how can I convert a UNIX timestamp, e.g. 1458297862, into a Date object in Elm?
Date.fromString does not seem to accept it, and Date.fromTime gives the wrong answer.
As the title reads, how can I convert a UNIX timestamp, e.g. 1458297862, into a Date object in Elm?
Date.fromString does not seem to accept it, and Date.fromTime gives the wrong answer.
I came across this answer and it didn't quite work in 0.18.
I found that Date.fromTime wouldn't accept arbitrary integers. The reason is that it's expecting floats, so you'd really want:
Date.fromTime (toFloat 1458297862000)