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

business_time_until doesn't account for holidays when called on Time objects #175

Open
s-v-z opened this issue Oct 19, 2017 · 1 comment

Comments

@s-v-z
Copy link

s-v-z commented Oct 19, 2017

The title is quite self-explanatory. busines_time_until returns inconsistent results when called on Time/DateTime objects and holidays are within the range.

Below is an example of such an inconsistency.

2.1.5 :017 > BusinessTime::Config.holidays.clear
=> #<SortedSet: {}>
2.1.5 :018 > BusinessTime::Config.holidays << Date.new(2017,10,18)
=> #<SortedSet: {Wed, 18 Oct 2017}>
2.1.5 :019 > start = Time.new(2017,10,16)
=> 2017-10-16 00:00:00 +0300
2.1.5 :020 > fin = Time.new(2017,10,20)
=> 2017-10-20 00:00:00 +0300
2.1.5 :021 > start.business_time_until(fin) / 3600
=> 27.0
2.1.5 :022 > (start.to_datetime.business_time_until(fin.to_datetime)).to_f / 3600
=> 18.000104166666667
@bokmann
Copy link
Owner

bokmann commented Dec 9, 2017

Will investigate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants