Johan
Johan

Reputation: 40510

Decoding epoch millis to "DateTime" in Elm 0.19?

Let's say I have an epoch millis value such as 1538637258426, how do I convert that into a something like a DateTime representation in Elm 0.19?

I'm not even sure which model I should use to represent a "date time" in Elm 0.19. I cannot find the Date module in core that is referred to from a lot of places on the web (such as this stackoverflow question). Also I cannot seem to install the elm-community/elm-time package since it's not upgraded to support 0.19.

Upvotes: 6

Views: 877

Answers (1)

glennsl
glennsl

Reputation: 29106

The official date/time library in 0.19 is elm/time, which has replaced the old Date module in core. The type you'll want to use is Time.Posix, which you can obtain from a milliseconds value using Time.millisToPosix.

Upvotes: 7

Related Questions