business_time icon indicating copy to clipboard operation
business_time copied to clipboard

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

Open s-v-z opened this issue 8 years ago • 1 comments

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

s-v-z avatar Oct 19 '17 12:10 s-v-z

Will investigate.

bokmann avatar Dec 09 '17 03:12 bokmann