aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Ganssle <paul@ganssle.io>2018-05-15 12:51:54 -0400
committerPaul Ganssle <paul@ganssle.io>2018-05-15 12:58:38 -0400
commit86c8f5bc16fb5c29722e456d8b00c120835176f5 (patch)
tree8d3be6b151055d5009ae069bfa0a98bccc26a7bd
parentf5d6b5303f9808e5440b20466e26ad387b13935d (diff)
downloaddateutil-86c8f5bc16fb5c29722e456d8b00c120835176f5.tar.gz
Add support for comma separator in isoparse
-rw-r--r--changelog.d/721.bugfix.rst1
-rw-r--r--dateutil/parser/isoparser.py8
2 files changed, 6 insertions, 3 deletions
diff --git a/changelog.d/721.bugfix.rst b/changelog.d/721.bugfix.rst
new file mode 100644
index 0000000..93f1b48
--- /dev/null
+++ b/changelog.d/721.bugfix.rst
@@ -0,0 +1 @@
+Add support for ISO 8601 times with comma as the decimal separator. (gh pr #721)
diff --git a/dateutil/parser/isoparser.py b/dateutil/parser/isoparser.py
index cd27f93..e274837 100644
--- a/dateutil/parser/isoparser.py
+++ b/dateutil/parser/isoparser.py
@@ -91,7 +91,9 @@ class isoparser(object):
- ``hh:mm:ss.sss`` or ``hh:mm:ss.ssssss`` (3-6 sub-second digits)
Midnight is a special case for `hh`, as the standard supports both
- 00:00 and 24:00 as a representation.
+ 00:00 and 24:00 as a representation. The decimal separator can be
+ either a dot or a comma.
+
.. caution::
@@ -193,7 +195,7 @@ class isoparser(object):
_MICROSECOND_END_REGEX = re.compile(b'[-+Z]+')
_DATE_SEP = b'-'
_TIME_SEP = b':'
- _MICRO_SEP = b'.'
+ _MICRO_SEPS = b'.,'
def _parse_isodate(self, dt_str):
try:
@@ -349,7 +351,7 @@ class isoparser(object):
if comp == 3:
# Microsecond
- if timestr[pos:pos + 1] != self._MICRO_SEP:
+ if timestr[pos:pos + 1] not in self._MICRO_SEPS:
continue
pos += 1