Invalid date being returned
liamcurry opened this issue · comments
Liam Curry commented
I'm getting an invalid date when I try to convert 1459530703000
into an ISO8601 string.
I'd expect it to be converted to:
2016-04-01T17:11:43Z
But instead it's being converted to:
2016-03-32T17:11:43Z
Here's an example from elm-repl
:
> import ISO8601
> time = 1459530703 * 1000
1459530703000 : number
> time |> ISO8601.fromTime
{ year = 2016, month = 3, day = 32, hour = 17, minute = 11, second = 43, millisecond = 0, offset = (0,0) } : ISO8601.Time
> time |> ISO8601.fromTime |> ISO8601.toString
"2016-03-32T17:11:43Z" : String
> import Date
> time |> toFloat |> Date.fromTime |> Date.day
1 : Int
As you can see Date.fromTime
gets the right day, so I assume something strange is going on with the offset conversions.
John Weir commented
Thank very much. 32 days in March looks a bit fishy.
Indeed there was a rounding issue at the transition of months. A patched version has been released.
Liam Curry commented
Awesome, thanks!