-
Notifications
You must be signed in to change notification settings - Fork 533
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
Years greater than 9999
require a +
at the beginning in NaiveDateTime::parse_from_str
#947
Comments
Thanks for the question @ethowitz - this is intended behaviour to conform with ISO8601 - essentially the standard primarily supports years 1583 through 9999, but wider ranges can be used, however five-digit and above years require either a |
Would it be ok to just add a note to the docs for this function as well to help future users? I can try to write a PR if this is something desirable. |
Yeah, documentation improvements for this would be great, thanks! |
Ok submitted a PR for the docs, happy to add or remove as you see fit. Added the (+/-) for consistency with what I added to the format information. Can remove both if it is not desirable. |
Closed the old pull request and create a new one because I needed to target 0.4.x and had originally started from main. |
Description
When calling
NaiveDateTime::parse_from_str
, years greater than 9999 require a+
sign at the beginning. I didn't see this in the documentation for that function or in the documentation forchrono::format::strftime
, though I do see that it's documented forNumeric::Year
, whichstrftime
appears to use internally. I wasn't sure if this was expected behavior, but I wanted to bring it to your attention. Thanks!Minimal example
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ecc55c3483a582e866c5bf5ae51d8325
Versions
rustc 1.64.0-nightly
chrono
0.4.21The text was updated successfully, but these errors were encountered: