business_time
business_time copied to clipboard
business_day.after does not handle starting time outside business hours properly
The latest version of business_time does not seem to handle calculating business_days.after() based on a date/time that starts outside business hours. An example:
irb(main):001:0> d=Time.parse("Saturday, August 17, 12:54am") => Sat Aug 17 00:54:00 -0700 2013 irb(main):002:0> 1.business_day.after(d) => Tue, 20 Aug 2013 00:54:00 PDT -07:00
It seems that business_days.after is completely ignoring the time, which seems to be wrong. It also seems to have the day off by one as 1 business day after should be the EOBD on Monday.
This is correct behavior. Here's what happens:
- Saturday, August 17th at 12:54 am is not a business day.
- We roll forward. the next business day starts Monday morning at Monday, August 19th at 0700PDT
- We add one business day to that, and you get Tuesday morning.
This matches the real world scenario of a company saying "We will process your paperwork within one business day", and has mail delivery on Saturday. The busines day clock doesn't start until Monday morning for the mail that arrived Saturday.
The date was not the issue, the time was. The resulting time is 00:54:00 which is not inside business hours. The rest of your logic I follow and agree with… but the resulting time is not correct. Note that using business_hours.after() works fine, it is just business_days.after() that does not.
Hmm... I agree, this seems like a real issue.
this may be related to issue #83