Skip to content

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
Collaborator

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 python-pendulum:master Jul 4, 2020
@sdispater
Copy link
Collaborator

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