Closed simerlec closed 5 years ago
I might be missing something, but according to Wikipedia it's not a valid format.
Thanks for your response!
It is described further below in the wiki article.
It further states that:
A single point in time can be represented by concatenating a complete date expression, the letter T as a delimiter, and a valid time expression. For example, "2007-04-05T14:30". If a time zone designator is required, it follows the combined date and time. For example, "2007-04-05T14:30Z" or "2007-04-05T12:30-02:00".
So I believe this means that the time zone designator is optional and the string 2018-09-06T00:00:00
should work.
Seems like I am wrong then. Would probably make sense to check standard itself to be double sure.
NaiveDateTime.to_iso8601
function of Elixir
produces a string without Z
at the end that fails with the current parser.
NaiveDateTime
is the default for the timestamps in Ecto (Elixir's db wrapper)
2018-09-06T00:00:00
is valid ISO8601, but it's an error to turn treat it as an Absolute time.
Because it represents Local Time (the offset is ambiguous), there is not enough information to construct a Posix time.
Parsing Local Time ISO8601 values should either fail, or require a fallback timezone to be supplied.
as @r-k-b pointed out, it's incorrect to default UTC when time zone designator is omitted. it should be "local time"
Though yes it's ambiguous and it'll be great if folks don't generate such strings in the first place, but 3rd party apis do. It's unfortunate that elm devs will obtain a wrong Time.Posix
:. as such, perhaps it would've been better before #18 -- at least elm devs know the parsing failed and could've done something about it (like appending their local time zone designator to the string before retrying parsing)
Hello,
If I'm not mistaken
2018-09-06T00:00:00
should be a valid ISO8601 format.I shamelessly copied and tweaked the Ellie example from @gyzerok. https://ellie-app.com/3jRZM4f34Hja1
thanks