bokmann / business_time

Support for doing time math in business hours and days
MIT License
1.27k stars 215 forks source link

.business_days.after and .business_days_until are not consistent with weekends/holidays #107

Closed AdnanTheExcellent closed 9 years ago

AdnanTheExcellent commented 9 years ago

I am having some issues with these two functions. They are not giving me consistent results. For instance:

the following example works. start date is feb 11th, delivery date is feb 13th. 2.business_days_after returns the 13th, which is expected. .business_days_until returns 2 business days which is expected.

start_date => Wed, 11 Feb 2015 12:00:00 -0800
delivery_date = 2.business_days.after(start_date) => Fri, 13 Feb 2015 12:00:00 PST -08:00
start_date.business_days_until(delivery_date) => 2

However, lets add a weekend and a holiday (feb 16th is a holiday in config) into the mix

start_date => Wed, 11 Feb 2015 12:00:00 -0800
delivery_date = 3.business_days.after(start_date) => Tue, 17 Feb 2015 12:00:00 PST -08:00
start_date.business_days_until(delivery_date) => 4

.business_days_until is returning 4 business days instead of the expected 3.

AdnanTheExcellent commented 9 years ago

@bokmann it seems https://github.com/bokmann/business_time/pull/95 fixes this issue. Is there any chance we can get this merged into master instead of just being in the develop branch?

Thanks!

bokmann commented 9 years ago

Yes, I've been neglecting a release we need. I'll try to do that this weekend.

Sent from my iPad. Please excuse any brvity, punctuation; or spalling mistakes.

On Feb 11, 2015, at 12:42 PM, Adnan Abdulally notifications@github.com wrote:

@bokmann it seems #95 fixes my problem. Is there any chance we can get this merged into master instead of just being in the develop branch?

Thanks!

— Reply to this email directly or view it on GitHub.

AdnanTheExcellent commented 9 years ago

Awesome. looking forward to the new version.

AdnanTheExcellent commented 9 years ago

Hello @bokmann. Just checking in to see what the status of the pull is.

bokmann commented 9 years ago

the develop branch was just merged into master ad released as 0.7.4. That version has an incompatibilty with ruby 2.2.0, and 0.8.0 will be release with feature parity, but with 2.2.0 support.

AdnanTheExcellent commented 9 years ago

Awesome. Keep up the good work!