-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Added documentation about out-of-range components to DateTime.parse. #44521
Conversation
@hoylen see review comments on https://dart-review.googlesource.com/c/sdk/+/176680 once they are addressed just push a new commit into your branch and it will be picked up automatically. |
sdk/lib/core/date_time.dart
Outdated
* them as overflows into the next larger component. | ||
* For example, "2020-01-42" will be parsed as 2020-02-11, because | ||
* the last valid date in that month is 2020-01-31, so 42 days is | ||
* interprted as 31 days of that month plus 11 days into the next month. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: interpreted*
Would really love to see this. Is this still being discussed? |
This is ready to land by requires rebase. |
Rebase done. Ready "to land". |
The DateTime.parse method accepts out-of-range components. For example, parsing the string "2020-01-42" produces "2020-02-11".
This was raised as a bug in #11189, but after more than 7 years that issue was closed with the solution being "use parseStrict from the intl package" instead.
This pull request simply updates the documentation of DateTime's parse method so that users know: