Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
```
2012-04-23T10:20:30.400-02
```
Django's `django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
```
2012-04-23T10:20:30.400 -02
```
Django's `django.utils.dateparse.parse_datetime` does not parse this
correctly and returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a very brittle REGEX to parse ISO-8601 datetime strings, and
python-dateutil does not.
I would recommend that Django:
1) Depend on python-dateutil
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
GitHub Pull Request: https://github.com/django/django/pull/14368
--
Ticket URL: <https://code.djangoproject.com/ticket/32727>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> ```
> 2012-04-23T10:20:30.400-02
> ```
> Django's `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
> ```
> 2012-04-23T10:20:30.400 -02
> ```
> Django's `django.utils.dateparse.parse_datetime` does not parse this
> correctly and returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a very brittle REGEX to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
>
> GitHub Pull Request: https://github.com/django/django/pull/14368
New description:
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
Django's `django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
Django's `django.utils.dateparse.parse_datetime` does not parse this
correctly and returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a very brittle REGEX to parse ISO-8601 datetime strings, and
python-dateutil does not.
I would recommend that Django:
1) Depend on python-dateutil
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
GitHub Pull Request: https://github.com/django/django/pull/14368
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:1>
Old description:
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400-02
>
> Django's `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400 -02
>
> Django's `django.utils.dateparse.parse_datetime` does not parse this
> correctly and returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a very brittle REGEX to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
>
> GitHub Pull Request: https://github.com/django/django/pull/14368
New description:
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
Django's `django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
Django's `django.utils.dateparse.parse_datetime` does not parse this
correctly and returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a very (brittle) to parse ISO-8601 datetime strings, and
python-dateutil does not.
I would recommend that Django:
1) Depend on python-dateutil
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
GitHub Pull Request: https://github.com/django/django/pull/14368
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:2>
Old description:
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400-02
>
> Django's `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400 -02
>
> Django's `django.utils.dateparse.parse_datetime` does not parse this
> correctly and returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a very (brittle) to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
>
> GitHub Pull Request: https://github.com/django/django/pull/14368
New description:
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
Django's `django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
Django's `django.utils.dateparse.parse_datetime` does not parse this
correctly and returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a very (brittle) to parse ISO-8601 datetime strings, and
python-dateutil does not.
https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
I would recommend that Django:
1) Depend on python-dateutil
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
GitHub Pull Request: https://github.com/django/django/pull/14368
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:3>
Old description:
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400-02
>
> Django's `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400 -02
>
> Django's `django.utils.dateparse.parse_datetime` does not parse this
> correctly and returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a very (brittle) to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
>
> GitHub Pull Request: https://github.com/django/django/pull/14368
New description:
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
Django's `django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
Django's `django.utils.dateparse.parse_datetime` does not parse this
correctly and returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a very (brittle) to parse ISO-8601 datetime strings, and
python-dateutil does not.
https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
I would recommend that Django:
1) Depend on python-dateutil for datetime string parsing
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
GitHub Pull Request: https://github.com/django/django/pull/14368
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:4>
Old description:
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400-02
>
> Django's `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400 -02
>
> Django's `django.utils.dateparse.parse_datetime` does not parse this
> correctly and returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a very (brittle) to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil for datetime string parsing
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
>
> GitHub Pull Request: https://github.com/django/django/pull/14368
New description:
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
Django's `django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
Django's `django.utils.dateparse.parse_datetime` does not parse this
correctly and returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
python-dateutil does not.
https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
I would recommend that Django:
1) Depend on python-dateutil for datetime string parsing
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
GitHub Pull Request: https://github.com/django/django/pull/14368
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:5>
Old description:
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400-02
>
> Django's `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400 -02
>
> Django's `django.utils.dateparse.parse_datetime` does not parse this
> correctly and returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil for datetime string parsing
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
>
> GitHub Pull Request: https://github.com/django/django/pull/14368
New description:
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
`django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
`django.utils.dateparse.parse_datetime` does not parse this correctly and
returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
python-dateutil does not.
https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
I would recommend that Django:
1) Depend on python-dateutil for datetime string parsing
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
GitHub Pull Request: https://github.com/django/django/pull/14368
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:6>
Old description:
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400-02
>
> `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400 -02
>
> `django.utils.dateparse.parse_datetime` does not parse this correctly and
> returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil for datetime string parsing
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
>
> GitHub Pull Request: https://github.com/django/django/pull/14368
New description:
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
`django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
`django.utils.dateparse.parse_datetime` does not parse this correctly and
returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
python-dateutil does not.
https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
I would recommend that Django:
1) Depend on python-dateutil for datetime string parsing
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
GitHub Pull Request: https://github.com/django/django/pull/14368
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:7>
Old description:
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400-02
>
> `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400 -02
>
> `django.utils.dateparse.parse_datetime` does not parse this correctly and
> returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil for datetime string parsing
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
>
> GitHub Pull Request: https://github.com/django/django/pull/14368
New description:
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
`django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
`django.utils.dateparse.parse_datetime` does not parse this correctly and
returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
python-dateutil does not.
https://github.com/django/django/blob/main/django/utils/dateparse.py#L22
https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
I would recommend that Django:
1) Depend on python-dateutil for datetime string parsing
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
GitHub Pull Request: https://github.com/django/django/pull/14368
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:8>
Old description:
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400-02
>
> `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400 -02
>
> `django.utils.dateparse.parse_datetime` does not parse this correctly and
> returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> https://github.com/django/django/blob/main/django/utils/dateparse.py#L22
> https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil for datetime string parsing
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
>
> GitHub Pull Request: https://github.com/django/django/pull/14368
New description:
GitHub Pull Request: https://github.com/django/django/pull/14368
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
`django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
`django.utils.dateparse.parse_datetime` does not parse this correctly and
returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
python-dateutil does not.
https://github.com/django/django/blob/main/django/utils/dateparse.py#L22
https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
I would recommend that Django:
1) Depend on python-dateutil for datetime string parsing
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:9>
Old description:
> GitHub Pull Request: https://github.com/django/django/pull/14368
>
> According to ISO-8601, there can be any number of whitespace characters
> between the time strings and timezone strings.
>
> Unfortunately the spec isn't public, but here's the link anyway
> https://www.iso.org/iso-8601-date-and-time-format.html.
>
> Examples:
>
> This is a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400-02
>
> `django.utils.dateparse.parse_datetime` parses this correctly.
>
> This is also a valid ISO-8601 datetime string:
>
> 2012-04-23T10:20:30.400 -02
>
> `django.utils.dateparse.parse_datetime` does not parse this correctly and
> returns `None`,
>
> However, `python-dateutil` parses it correctly. The difference is that
> Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
> python-dateutil does not.
>
> https://github.com/django/django/blob/main/django/utils/dateparse.py#L22
> https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
>
> I would recommend that Django:
>
> 1) Depend on python-dateutil for datetime string parsing
> 2) Inline python-dateutils' parsing functions
>
> As far as I know there is no regex that can parse the full spec of
> ISO-8601 datetime strings.
>
> In the meantime, this is a patch to support (valid) whitespace characters
> between the seconds/millseconds part and the timezone string.
New description:
GitHub Pull Request: https://github.com/django/django/pull/14368
According to ISO-8601, there can be any number of whitespace characters
between the time strings and timezone strings.
Unfortunately the spec isn't public, but here's the link anyway
https://www.iso.org/iso-8601-date-and-time-format.html.
Examples:
This is a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400-02
`django.utils.dateparse.parse_datetime` parses this correctly.
This is also a valid ISO-8601 datetime string:
2012-04-23T10:20:30.400 -02
`django.utils.dateparse.parse_datetime` does not parse this correctly and
returns `None`,
However, `python-dateutil` parses it correctly. The difference is that
Django uses a (brittle) regex to parse ISO-8601 datetime strings, and
python-dateutil does not.
https://github.com/django/django/blob/main/django/utils/dateparse.py#L22
https://github.com/dateutil/dateutil/blob/master/dateutil/parser/isoparser.py
I recommend that Django:
1) Depend on python-dateutil for datetime string parsing
OR
2) Inline python-dateutils' parsing functions
As far as I know there is no regex that can parse the full spec of
ISO-8601 datetime strings.
In the meantime, this is a patch to support (valid) whitespace characters
between the seconds/millseconds part and the timezone string.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:10>
* version: 3.2 => dev
* stage: Unreviewed => Accepted
Comment:
Thanks for the patch. Ticket accepted at least to fix the space issue.
Could you please open a new thread with your rationales on the django-
developers mailing list about the suggestion of depending on python-
dateutil? Adding a new project dependency is no light decision, so it
would need to be supported by a clear majority of developers.
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:11>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:12>
Comment (by Ben Wilber):
Replying to [comment:12 Claude Paroz]:
Yes I'll start a thread on django devs. Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:13>
* owner: nobody => Ben Wilber
* status: new => assigned
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:14>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"fff4870bfa7ed4d9ab6be0060364b23c66ad1af0" fff4870]:
{{{
#!CommitTicketReference repository=""
revision="fff4870bfa7ed4d9ab6be0060364b23c66ad1af0"
Fixed #32727 -- Allowed spaces before time zone offset in
parse_datetime().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32727#comment:15>