#36747: parse_duration() fails to parse valid ISO-8601 durations including
years,
months, and weeks due to incorrect regex
--------------------------------+--------------------------------------
Reporter: florianvazelle | Owner: (none)
Type: Bug | Status: new
Component: Uncategorized | Version: 5.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+--------------------------------------
Comment (by David):
This is a limit of supporting Python's `timedelta` which does not support
years and months: https://docs.python.org/3/library/datetime.html
#timedelta-objects.
Yet it supports weeks, thus the parsing in django could be improved to
also support ISO8601 duration with weeks.
If you need to support every IS08601 duration you can use
https://github.com/CodeYellowBV/django-relativedelta which offers support
for `relativedelta` which implements a more complete timedelta class.
--
Ticket URL: <https://code.djangoproject.com/ticket/36747#comment:2>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019aa1784b5b-fa053370-4e14-43ec-9379-a163ecba3290-000000%40eu-central-1.amazonses.com.