I think the gotcha here is that there are various "profiles" of ISO-8601, and the one we typically think of as ISO-8601 in practice is the W3C profile used on the web (see https://www.w3.org/TR/NOTE-datetime for a description of what that profile includes). The other common profile is RFC-3339 which also excludes some of the more esoteric formats, like ordinal dates, but also makes at least one modification of its own to the extended time format.
I think we should probably consider this a bug, and fix functions which parse ISO-8601 dates so that they support what's allowed in the ISO-8601 spec, unless we want to explicitly document that Elixir is using one of the common, more restrictive, profiles. Off the top of my head I don't see any reason why extending the parser would be a backwards incompatible change though, and more likely it may fix some bugs where consuming code was assuming that any valid ISO-8601 date was accepted. Paul On Wed, Feb 3, 2021, at 7:54 PM, Christopher Keele wrote: > As observed by @ryanbigg <https://twitter.com/ryanbigg> on Twitter > <https://twitter.com/ryanbigg/status/1356847900035190786>, *"2021-034"* is a > valid ISO 8601 date. > > Specifically, it is an ordinal date > <https://en.wikipedia.org/wiki/Ordinal_date> descriptor of the format > YYYY-DDD. Unlike some of the more exotic ISO 8601 formats, like naming a week > of the year or a day+month without a year; it does fully describe a single > date in time. > > As Ryan observes, Ruby supports parsing ordinal date strings but Elixir does > not. Is this something we'd want to add? Honestly the correct behaviour here > is almost more surprising to me than our lack of support for it, but I wanted > to field a discussion about it. > > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/51e44339-31aa-4ec6-93c8-3ca0f7901926n%40googlegroups.com > > <https://groups.google.com/d/msgid/elixir-lang-core/51e44339-31aa-4ec6-93c8-3ca0f7901926n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/4ca84a43-62d7-41c5-bae3-c0109fc8a379%40www.fastmail.com.
