adding a datetime to a relativedelta with a non-integer month value gives a TypeError
Bug #1204017 reported by
Josh
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dateutil |
New
|
Undecided
|
Unassigned |
Bug Description
Adding a datetime to a relativedelta that has the months set to a non-integer value gives the following:
TypeError: integer argument expected, got float
A similar bug is here:
https:/
The patch for that bug could probably be generalised to fix this same issue in the __add__, __sub__ and __neg__ methods of relativedelta as a stop-gap. But ideally one should be able to add 1.5 months to a datetime and have it return another datetime that's actually 1.5 months in the future (whatever 1.5 months might mean). Casting to an int doesn't really provide that.
Attached code reproduces the issue.
To post a comment you must log in.