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

Fix subtracting negative timedelta around DST #419

Conversation

tomage
Copy link
Contributor

@tomage tomage commented Oct 25, 2019

Noticed that in a very specific case, subtracting a negative timedelta yielded different results than adding the same positive timedelta.

I.e. my_dt + timedelta(hours=10) ~= my_dt - timedelta(hours=-10).

Digging into the git log, I found that a similar fix was done for the positive case here: 1ec1ad0.

It seemed logical/symmetrical to do similar with the negative case, although there may have been some good reasons for why _add_timedelta() is different from _subtract_timedelta() that I'm missing.

I also threw in one test case to test specifically subtracting a negative timedelta.

Looking forward to your feedback as always.

@sdispater
Copy link
Owner

Thanks for your contribution!

Can you rebase your PR on master?

@tomage tomage force-pushed the fix-subtracting-negative-timedelta-around-dst branch from 15ded3f to 9751130 Compare March 8, 2020 02:31
@tomage
Copy link
Contributor Author

tomage commented Mar 8, 2020

Sure thing! Just rebased on top of latest master from you.

(Just did the same for my other 2 PRs: #414 and #416)

@sdispater sdispater merged commit 4fd7174 into sdispater:master Jul 4, 2020
@sdispater
Copy link
Owner

Thanks for your contribution!

@sdispater sdispater mentioned this pull request Jul 13, 2020
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

Successfully merging this pull request may close these issues.

2 participants