diff options
author | Ho <921345@emea.kuoni.int> | 2018-06-08 11:45:24 +0100 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-06-08 12:14:09 +0100 |
commit | 424a438b3791962e50590410972fdb0ebfd7b4a2 (patch) | |
tree | 6ef74a59a9b3a449b76c176f89e34d0a04eebfde /dateutil/parser | |
parent | 86e33512c41a04b989b14966a722608035a87b51 (diff) | |
download | dateutil-424a438b3791962e50590410972fdb0ebfd7b4a2.tar.gz |
Fix isoparser misinterprets T24:00
- Update tests with the correct examples
- Update AUTHORS.md
- Closes GH issue #658
Diffstat (limited to 'dateutil/parser')
-rw-r--r-- | dateutil/parser/isoparser.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/dateutil/parser/isoparser.py b/dateutil/parser/isoparser.py index e274837..3e2a09a 100644 --- a/dateutil/parser/isoparser.py +++ b/dateutil/parser/isoparser.py @@ -139,6 +139,10 @@ class isoparser(object): else: raise ValueError('String contains unknown ISO components') + if len(components) > 3 and components[3] == 24: + components[3] = 0 + return datetime(*components) + timedelta(days=1) + return datetime(*components) @_takes_ascii @@ -169,6 +173,9 @@ class isoparser(object): :return: Returns a :class:`datetime.time` object """ + components = self._parse_isotime(timestr) + if components[0] == 24: + components[0] = 0 return time(*self._parse_isotime(timestr)) @_takes_ascii @@ -368,7 +375,6 @@ class isoparser(object): # Standard supports 00:00 and 24:00 as representations of midnight if any(component != 0 for component in components[1:4]): raise ValueError('Hour may only be 24 at 24:00:00.000') - components[0] = 0 return components |