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

Handle negative business days and hours #158

Merged
merged 3 commits into from Jun 7, 2017

Conversation

xlts
Copy link
Contributor

@xlts xlts commented May 5, 2017

No description provided.

@bokmann
Copy link
Owner

bokmann commented May 14, 2017

Can you provide a business need / example of where negative business days/hours is used? I really appreciate the tests you've written to cover this; I just want to understand the business consideration before adding it to the gem.

@xlts
Copy link
Contributor Author

xlts commented May 14, 2017

@bokmann Thanks. I don't think anyone would use it deliberately like -3.business_days.before(date); this pull request basically addresses the unexpected behavior described in #119. However, in my project I do plenty of business time calculations and often find myself adding checks in the fashion of calculated_days > 0 ? calculated_days.after(date) : calculated_days.before(date), in such case this if statement would not be needed and everything would work, well, according to the principle of least astonishment when called on negative numbers.

@bokmann
Copy link
Owner

bokmann commented Jun 1, 2017

Thanks for the explanation. I'll be merging this and releasing next week when I teach an internal class on release management.

@bokmann bokmann merged commit 71e622d into bokmann:develop Jun 7, 2017
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.

None yet

2 participants