Open smucode opened 3 years ago
Thank you. The first case is valid (surprisingly, right?) according to ISO-8601 which can have just a year, it can even be less precise and just include a century -> 99 would be 9900. Although this library does not support that, it doesn't support the full spec (and never will).
The second case is more interesting. Should this library allow parsing a time from a string such as "I was born on 1995-02-03"
? Perhaps it should be very strict and disallow that, or perhaps it should be liberal and allow it.
I am going to be robust here and be liberal in what is accepted.
Have no fear though, there is a stricter library with many advantages over elm-iso8601. https://github.com/rtfeldman/elm-iso8601-date-strings. It will only take dates/times, and I believe it requires a minimum of a calendar day defined. And it generates a Posix type, which in many cases (but not all) is superior to the record which elm-iso8601 generates.
Alright, that makes sense! Digging into an issue today, I was a little surprised when a Json.Decode.oneOf
ended up decoding device:///bfb4d9a6-d272-a9cb-b1d6-8b5cc3fc43c7/8d2d356c-650b-66f7-61d9-176c6aea2701
into Posix 23068108800000
rather than a string :)
Pretty sure neither of these should be valid.