Opened 5 years ago
Closed 5 years ago
#30803 closed New feature (fixed)
Dateparse function should support comma separators for milliseconds according to ISO-8601
Reported by: | Ben Wilber | Owned by: | Farhaan Bukhsh |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Presently the regex for parsing ISO-8601 formatted datetimes in django.utils.dateparse.parse_time and parse_datetime only supports period (.) separators for milliseconds.
Examples:
2014-08-06T11:00:00.000Z
2014-08-06T11:00:00,000Z
ISO 8601:2004 states that parsers should support both delineators, with a preference for commas. https://www.iso.org/standard/40874.html
A decimal mark, either a comma or a dot (without any preference as stated in resolution 10 of the 22nd General Conference CGPM in 2003,[16] but with a preference for a comma according to ISO 8601:2004)
Github Pull Request: https://github.com/django/django/pull/11818
Change History (9)
comment:1 by , 5 years ago
Component: | Uncategorized → Utilities |
---|---|
Type: | Uncategorized → Bug |
Version: | 2.2 → master |
follow-up: 3 comment:2 by , 5 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → New feature |
comment:3 by , 5 years ago
Replying to Simon Charette:
I don't see much harm in supporting comma separators but I couldn't get my hand on a copy of
ISO 8601:2004
to confirm the report. Tentatively accepting.
Are you aware in any changes in
ISO 8601-1:2019
andISO 8601-2:2019
given they supersede the now withdrawnISO 8601:2004
?
It might be worth adding a mention in the release notes about this change even if it's minor.
I'm not aware of anything in the 2019 revisions that has changed regarding periods vs commas for separating milliseconds. Unfortunately the full specs are not publicly available to confirm. I can add a note to the release notes. Which would be the appropriate release notes document to mention this?
comment:4 by , 5 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Owner: | changed from | to
Status: | new → assigned |
comment:5 by , 5 years ago
Hey, I would love to complete this PR, what can be the next steps? I see writing tests as one of them. Thanks a ton in advance. :)
comment:7 by , 5 years ago
Needs documentation: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
I don't see much harm in supporting comma separators but I couldn't get my hand on a copy of
ISO 8601:2004
to confirm the report. Tentatively accepting.Are you aware in any changes in
ISO 8601-1:2019
andISO 8601-2:2019
given they supersede the now withdrawnISO 8601:2004
?It might be worth adding a mention in the release notes about this change even if it's minor.