Skip to content

BaseOffset arithmetic methods (add, sub, etc.) accept a _DatetimeT but a date is a valid parameter value #224

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

Closed
gandhis1 opened this issue Aug 24, 2022 · 2 comments

Comments

@gandhis1
Copy link
Contributor

An error will be given if attempting to subtract an offset from a datetime.date

Should be the Union of the two

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Aug 24, 2022

Please provide an example that illustrates a type checker showing an error.

@gandhis1
Copy link
Contributor Author

from datetime import date
from pandas.tseries.offsets import Day

x = date.today() - Day()

test_case.py:4: error: No overload variant of "sub" of "date" matches argument type "Day"
test_case.py:4: note: Possible overload variants:
test_case.py:4: note: def __sub__(self, timedelta) -> date
test_case.py:4: note: def __sub__(self, date) -> timedelta
Found 1 error in 1 file (checked 1 source file)

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

No branches or pull requests

3 participants