-
-
Notifications
You must be signed in to change notification settings - Fork 415
Open
Description
- I am on the latest Pendulum version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- OS version and name: MacOS 14.5
- Pendulum version: 3.0
Issue
While tinkering with Duration, I found several bugs and edge cases that might be good to patch:
Parsing partially ignores long numbers
>>> parse ('PT999900000000000000000000000000000002S')
Duration(seconds=2) # earlier digits get forgottenIncorrectly duplicated components are parsed anyway, with inconsistent results
>>> parse("P12M4M")
Duration(months=4) # should be an error, but takes the last one
>>> parse("PT12M3M1M")
Duration(minutes=16) # should also be an error, but sums themValues overflow
>>> parse("PT4294967297M")
Duration(minutes=1)'empty' duration shouldn't be allowed
>>> parse('PT')
Duration() # should be an error, this isn't allowed in ISO8601Strange month arithmetic
>>> parse("P1M") + Duration()
Duration(weeks=4, days=2)
>>> Duration(months=1) * 1.0
Duration()
>>> Duration(months=1) * 1
Duration(months=1)Probably related to #799
Metadata
Metadata
Assignees
Labels
No labels