isoduration icon indicating copy to clipboard operation
isoduration copied to clipboard

Can't add duration to datetime.

Open jcable opened this issue 11 months ago • 1 comments

With Python 3.11.6 (main, Nov 27 2023, 16:51:41) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin:

import datetime
from isoduration import parse_duration
dt=datetime.datetime.fromisoformat('2024-12-13T17:50:08.406635Z')
dur=parse_duration('PT57M51.76S')
print(dt+dur)

ValueError: second must be in 0..59

jcable avatar Dec 16 '24 08:12 jcable

confirmed the problem is with the fractional seconds in the duration. These are parsed correctly but not added correctly.

jcable avatar Dec 16 '24 08:12 jcable