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

Not getting a negative duration from datediff when I reversed the two dates #161

Open
tinker2much opened this issue Sep 27, 2024 · 2 comments

Comments

@tinker2much
Copy link

I expected the second one to give a negative duration.

pi@pi0w:~/bin $ dateutils.ddiff 2024-09-26T18:00:00-05:00 2024-09-26T19:33:07-0500  -f '%Y years %m months %w weeks %d days %H hours %M minutes %S seconds'
0 years 0 months 0 weeks 0 days 1 hours 33 minutes 7 seconds

pi@pi0w:~/bin $ dateutils.ddiff 2024-09-26T19:33:07-0500 2024-09-26T18:00:00-0500  -f '%Y years %m months %w weeks %d days %H hours %M minutes %S seconds'
0 years 0 months 0 weeks 0 days 1 hours 33 minutes 7 seconds

@tinker2much
Copy link
Author

Although, if I remove the time zone portion, it works as expected:

pi@pi0w:~/bin $ dateutils.ddiff 2024-09-26T18:00:000 2024-09-26T19:33:07  -f '%Y years %m months %w weeks %d days %H hours %M minutes %S seconds'
0 years 0 months 0 weeks 0 days 1 hours 33 minutes 7 seconds

pi@pi0w:~/bin $ dateutils.ddiff 2024-09-26T19:33:07 2024-09-26T18:00:00  -f '%Y years %m months %w weeks %d days %H hours %M minutes %S seconds'
-0 years 0 months 0 weeks 0 days 1 hours 33 minutes 7 seconds

@hroptatyr
Copy link
Owner

Hi, thanks for the report, very difficult to spot. A fix should be in 00a29db which can be applied to any of the 0.4.x releases.

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

2 participants