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

1.business_day.before(date) not working #101

Closed
valk opened this issue Jan 11, 2015 · 2 comments · Fixed by #104
Closed

1.business_day.before(date) not working #101

valk opened this issue Jan 11, 2015 · 2 comments · Fixed by #104

Comments

@valk
Copy link

valk commented Jan 11, 2015

Please consider the following:

date = '12-Jan-2015'.to_date
=> Mon, 12 Jan 2015
1.business_day.before(date)
=> Fri, 09 Jan 2015 00:00:00 UTC +00:00

date = '11-Jan-2015'.to_date
=> Sun, 11 Jan 2015
1.business_day.before(date)
=> Thu, 08 Jan 2015 00:00:00 UTC +00:00

Same result if I set:

BusinessTime::Config.work_week = %w[mon tue wed thu fri]

It looks like a bug or am I missing any relevant setting?

Thanks.

@mifix
Copy link
Contributor

mifix commented Jan 17, 2015

Looking at the test, it seems this is intended behaviour:

it "move to thursday if we subtract one business day during a weekend" do

I just stumbled upon this issue myself, because after an update to the latest version of this gem my tests blew up.

To be honest, I do not understand the logic behind this change.

@mifix
Copy link
Contributor

mifix commented Jan 17, 2015

I think I just found the explanation in issue #45. Looks like this was intended this way from the beginning.

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 a pull request may close this issue.

3 participants