-
Notifications
You must be signed in to change notification settings - Fork 384
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
RFC: Deprecate Timex.compare and change Timex.diff to a signed integer result #137
Comments
@tallakt I believe the reason I changed this was because a signed diff didn't seem useful to me when one could use Another question then becomes, if diff returns a signed value, is |
I would rather just use |
Agreed on the docs. I'll think about these two functions in general and post back here with my decision. Chances are I will deprecate |
I've updated the docs in the meantime |
After giving it a bit of thought, it is probably more intuitive that dates arithmetic with dates behave like with normal numbers, with signed results, eg:
you could always just use |
@tallakt Agreed. I think I'll make that change sooner rather than later, because I don't want the current behaviour to become too entrenched. |
FWIW, I'm working on upgrading to 2.0 and the fact that Anyhow, sounds like you are already planning and restoring the signed behavior but I wanted to lend my voice to it as well :). |
By the way, the signed behavior of
...which helps explain the behavior. I think that it's easy to assume that |
@myronmarston This has been merged into master and the behaviour is exactly as you describe it, putting an older date before a newer one returns a negative value, and vice versa. The same behaviour as compare. |
This RFC has been merged in 3.0, so the diff behaviour is again signed. |
According to the docs, the result should be signed. Timex version 2.1.1
The text was updated successfully, but these errors were encountered: