We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When doing math on Duration objects, months are ignored. This is because it uses the _to_microseconds method which ignores the months attribute.
Duration
_to_microseconds
months
pendulum/src/pendulum/duration.py
Lines 356 to 357 in 3e3fec6
>>> pendulum.Duration(years=1)/pendulum.Duration(months=1) Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2022.2.2\plugins\python\helpers\pydev\pydevconsole.py", line 364, in runcode coro = func() File "<input>", line 1, in <module> File "C:\Users\chase\PycharmProjects\Flexget\py310\lib\site-packages\pendulum\duration.py", line 419, in __truediv__ float, usec / other._to_microseconds() # type: ignore[attr-defined] ZeroDivisionError: division by zero >>> pendulum.Duration(months=1)*3.0 Duration()
The text was updated successfully, but these errors were encountered:
Duration only supports full months and years, hence floating-point multiplication is not supported.
@sdispater @Secrus I see two options here:
years>0
months>0
__truediv__
Lines 431 to 439 in 3e3fec6
Sorry, something went wrong.
No branches or pull requests
Issue
When doing math on
Duration
objects, months are ignored. This is because it uses the_to_microseconds
method which ignores themonths
attribute.pendulum/src/pendulum/duration.py
Lines 356 to 357 in 3e3fec6
e.g. :
The text was updated successfully, but these errors were encountered: