You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Duration division, multiplication and mod broken for month lengths. #799
It should be relatively straight forward to defer to .total_seconds() since this already makes use of the years and months attributes correctly. I do agree that the number of microseconds (or seconds) in a month or year is ambiguous however pendulum already hardcodes these to be month=30days, year=365days. So given that, it should be possible to divide months by months, for example.
Activity
Benji19967 commentedon Mar 8, 2024
Durationonly supports full months and years, hence floating-point multiplication is not supported.@sdispater @Secrus I see two options here:
Durationwithyears>0and/ormonths>0.__truediv__https://github.com/sdispater/pendulum/blob/3e3fec6a5b66759078c5ae39c736ca95b78adbef/src/pendulum/duration.py#L431-L439ruaridhw commentedon Apr 14, 2025
It should be relatively straight forward to defer to
.total_seconds()since this already makes use of the years and months attributes correctly. I do agree that the number of microseconds (or seconds) in a month or year is ambiguous however pendulum already hardcodes these to be month=30days, year=365days. So given that, it should be possible to divide months by months, for example.