elm-community / elm-time

A pure Elm date and time library.

Home Page:http://package.elm-lang.org/packages/elm-community/elm-time/latest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error parsing a valid ISO8601 date with a year less than 1000

waratuman opened this issue · comments

When using the Time.Date.fromISO8601 an error is thrown for a correct date. The same is true in reverse as well. When generating an ISO8601 string from the date 0001-01-01 a non ISO8601 string is returned.

Example:

> import Time.Date
> Time.Date.fromISO8601 "0001-01-01"
Err "Errors encountered at position 1: expected \"-\""
    : Result.Result String Time.Date.Date
> Time.Date.date 1 1 1 |> Time.Date.toISO8601
"1-01-01" : String

Hi @waratuman. Good catch; good solution, thank you. Also thanks for adding the unit tests.

I'm toward the very end of a major rewrite; if I submit the rewrite this weekend, I'll include yours in that release. Otherwise I'll just do yours in a patch release this same weekend.

This PR #62 has been merged, deployed, and published. Closing this issue