gweis / isodate

ISO 8601 date/time parser
BSD 3-Clause "New" or "Revised" License
155 stars 59 forks source link

Rounding of seconds resulting in 60 breaks parse_time. (...:59.9999999) #69

Closed olekang closed 3 years ago

olekang commented 3 years ago

Rounding of fractional seconds breaks when it rounds to 60. (Presumably true for other fractions)

isodate.parse('9999-12-31T23.59.59.9999999') <- DateTime.Max from MS .NET

Example: Python 3.7.3 (default, Jan 22 2021, 20:04:44)

>>> import isodate
>>> isodate.parse_datetime('2021-11-12T13:48:59.9999999')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "python3.7/site-packages/isodate/isodatetime.py", line 56, in parse_datetime
    tmptime = parse_time(timestring)
  File "python3.7/site-packages/isodate/isotime.py", line 134, in parse_time
    tzinfo)
ValueError: second must be in 0..59

Verison:

$ pip show isodate
Name: isodate
Version: 0.6.0
<snip>
olekang commented 3 years ago

Somewhat less likely to be used, but same issue.

isodate.parse_datetime('2020-01-01T23:59.999999999')
isodate.parse_datetime('2020-01-01T23.999999999')

Results in ValueError: microsecond must be in 0..999999

hugovk commented 3 years ago

Duplicate of https://github.com/gweis/isodate/issues/53?

olekang commented 3 years ago

Duplicate og #53. Which seems to be closed?

hugovk commented 3 years ago

53 is open :)