-
Notifications
You must be signed in to change notification settings - Fork 444
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
Allow specifying an explicit format in parse_date/parse_time #1131
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1131 +/- ##
==========================================
+ Coverage 91.28% 91.29% +0.01%
==========================================
Files 27 27
Lines 4623 4630 +7
==========================================
+ Hits 4220 4227 +7
Misses 403 403
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Minor doc-related request, LGTM otherwise!
babel/dates.py
Outdated
This function first tries to interpret the string as ISO-8601 | ||
date format, then uses the date format for the locale as a hint to | ||
determine the order in which the date fields appear in the string. | ||
|
||
If an explicit format is provided, the function will use it to parse | ||
the date instead. |
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.
This should note that the ISO-8601 attempt isn't done when you use an explicit format. Might need to rephrase the whole thing to make that flow nicely.
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.
I changed it up a bit so that it hopefully reads better now. Also added an example with an explicit format=...
.
Closes #1090
This uses
parse_pattern
internally when a custom format is used.