summaryrefslogtreecommitdiff
path: root/django/utils/dateparse.py
diff options
context:
space:
mode:
authorSeunghun Lee <waydi1@gmail.com>2019-02-16 16:43:42 +0900
committerTim Graham <timograham@gmail.com>2019-02-23 18:54:09 -0500
commit99fc5dc13c12d874ffc1c8f47a6421494e720b31 (patch)
tree0a1f65ab7898c199ad60a814613579ecf04899a3 /django/utils/dateparse.py
parent36300ef336e3f130a0dadc1143163ff3d23dc843 (diff)
downloaddjango-99fc5dc13c12d874ffc1c8f47a6421494e720b31.tar.gz
Fixed #30141 -- Fixed parse_duration() for some negative durations.
Diffstat (limited to 'django/utils/dateparse.py')
-rw-r--r--django/utils/dateparse.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/utils/dateparse.py b/django/utils/dateparse.py
index 8d08b7d1d3..f90d952581 100644
--- a/django/utils/dateparse.py
+++ b/django/utils/dateparse.py
@@ -29,9 +29,10 @@ datetime_re = re.compile(
standard_duration_re = re.compile(
r'^'
r'(?:(?P<days>-?\d+) (days?, )?)?'
- r'((?:(?P<hours>-?\d+):)(?=\d+:\d+))?'
- r'(?:(?P<minutes>-?\d+):)?'
- r'(?P<seconds>-?\d+)'
+ r'(?P<sign>-?)'
+ r'((?:(?P<hours>\d+):)(?=\d+:\d+))?'
+ r'(?:(?P<minutes>\d+):)?'
+ r'(?P<seconds>\d+)'
r'(?:\.(?P<microseconds>\d{1,6})\d{0,6})?'
r'$'
)