FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix subtracting negative timedelta around DST by tomage · Pull Request #419 · python-pendulum/pendulum · GitHub

Fix subtracting negative timedelta around DST - #419

Merged
sdispater merged 1 commit into
python-pendulum:masterfrom
tomage:fix-subtracting-negative-timedelta-around-dst
Jul 4, 2020
Merged

Fix subtracting negative timedelta around DST#419
sdispater merged 1 commit into
python-pendulum:masterfrom
tomage:fix-subtracting-negative-timedelta-around-dst

Conversation

tomage commented Oct 25, 2019

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Collaborator

Thanks for your contribution!

Can you rebase your PR on master?

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

tomage commented Mar 8, 2020

Copy link
Copy Markdown
Contributor Author

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

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

sdispater merged commit 4fd7174 into python-pendulum:master Jul 4, 2020

Copy link
Copy Markdown
Collaborator

Thanks for your contribution!

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL