#18728: dateparse datetime regex should accept colon in TZ offset
-------------------------------+----------------------------------------
Reporter: thaxter | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.4
Severity: Normal | Keywords: datetime dateparse iso8601
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+----------------------------------------
A legitimate ISO8601 datetime such as 2012-08-07T15:17:59.000+0000 will be
rejected as input to a DateTime field. The dateparse.datetime_re matches
with the colon: 2012-08-07T15:17:59.000+00:00.
According to spec, both are acceptable. Simply adding a ? after the colon
in the regex fixes it:
{{{
datetime_re = re.compile(
r'(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})'
r'[T ](?P<hour>\d{1,2}):(?P<minute>\d{1,2})'
r'(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?'
r'(?P<tzinfo>Z|[+-]\d{1,2}:?\d{1,2})?$'
)
}}}
Diff format:
{{{
21c21
< r'(?P<tzinfo>Z|[+-]\d{1,2}:\d{1,2})?$'
---
> r'(?P<tzinfo>Z|[+-]\d{1,2}:?\d{1,2})?$'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/18728>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.