-
Notifications
You must be signed in to change notification settings - Fork 3.4k
DateTime with year 10000+ and Inspect #13712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
ISO has extensions for multi-digit years, we should probably support them, now that we lifted the year 9999 restriction. We can probably support them as a slow path. PRs welcome. |
The standard mandates that +/- be at the beginning of a year∈(-∞,-9999)∪(9999,+∞). For formatting, we can add the Another part of the standard says that interchanging parties need to decide on how many digits for years∈(-∞,-9999)∪(9999,+∞). The draft implementation I have can potentially parse forever, since it just takes characters until it reaches a separator. What kind of limit would be reasonable if there should be any? I also noticed that the recent changes accept years∈(-∞,-9999)∪(9999,+∞) for the basic format. This is fine when converting to a string, but it fails to parse since we're expecting only the basic format of |
You are right. ISE8601-2, section 4.7.2., mentions it is possible to extend this by prefixing Y, but the wording is ambiguous:
It is unclear if calendar year means the date only has the calendar year or if it has only the calendar year part (and not a decade or century one). In any case, I think for now the simplest is to not use the ISO representation for dates outside of -9999..9999. I will push a fix. |
Elixir and Erlang/OTP versions
Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.18.0-dev (d9cf285) (compiled with Erlang/OTP 27)
Operating system
macOS
Current behavior
Currently DateTime inspect implementations returns the sigil that is invalid:
Same goes for
NaiveDateTime
.Expected behavior
First,
Date
solves this well:so I think we want something akin to that. Perhaps something along the lines of:
Note, with non-UTC datetimes we have
#DateTime<>
:and so maybe we do that too here:
The text was updated successfully, but these errors were encountered: