diff --git a/elm.json b/elm.json index 672b5de..f298f17 100644 --- a/elm.json +++ b/elm.json @@ -3,7 +3,7 @@ "name": "rtfeldman/elm-iso8601-date-strings", "summary": "Convert ISO8601 date strings to and from Posix times", "license": "BSD-3-Clause", - "version": "1.1.3", + "version": "1.1.4", "exposed-modules": [ "Iso8601" ], diff --git a/src/Iso8601.elm b/src/Iso8601.elm index 230559f..b680d92 100644 --- a/src/Iso8601.elm +++ b/src/Iso8601.elm @@ -100,7 +100,7 @@ epochYear = yearMonthDay : ( Int, Int, Int ) -> Parser Int yearMonthDay ( year, month, dayInMonth ) = - if dayInMonth < 0 then + if dayInMonth < 1 then invalidDay dayInMonth else diff --git a/tests/Example.elm b/tests/Example.elm index 83c6590..cd4c94a 100644 --- a/tests/Example.elm +++ b/tests/Example.elm @@ -59,6 +59,10 @@ knownValues = \_ -> Iso8601.toTime "1970-01-01" |> Expect.equal (Ok (Time.millisToPosix 0)) + , test "Invalid day gives error" <| + \_ -> + Iso8601.toTime "2000-01-00" + |> Expect.err , test "toTime supports microseconds precision" <| \_ -> Iso8601.toTime "2018-08-31T23:25:16.019345+02:00"