Skip to content
New issue

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

Cannot check == between Period and timedelta #421

Closed
shabbyrobe opened this issue Nov 9, 2019 · 1 comment · Fixed by #427
Closed

Cannot check == between Period and timedelta #421

shabbyrobe opened this issue Nov 9, 2019 · 1 comment · Fixed by #427

Comments

@shabbyrobe
Copy link

Hello, I'm having trouble comparing the result of subtracting two DateTimes with a timedelta. If I run the following snippet:

import pendulum
from pendulum.period import Period
from datetime import timedelta
d1 = pendulum.datetime(2019, 1, 2, tz='UTC')
d2 = pendulum.datetime(2019, 1, 1, tz='UTC')
period = d1 - d2
print(period == timedelta(days=1))

I get the following error, instead of the True I was expecting:

AttributeError: 'datetime.timedelta' object has no attribute 'start'
@wakemaster39
Copy link
Contributor

Comparison against anything that was not a Period was broken, opened a PR to fail over to Duration if other is not a Period.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants