business_time
business_time copied to clipboard
Trouble understanding results
I seem to be having some issues with business_time
. I'm not sure if I'm not using it properly or not understanding the results properly. Can you explain how this result occurs?
2.3.1 :031 > d1 = DateTime.parse('2017-01-07 19:55:29.842345')
=> Sat, 07 Jan 2017 19:55:29 +0000
2.3.1 :032 > 3.business_days.after(d1)
=> Fri, 13 Jan 2017 09:00:00 +0000
I would expect 3 business days to be January 11th. I have no idea how this results in the 13th. Even more confusing, a later starting date (2 days later, Jan 9th 00:00), considers 3 business days from that date to be earlier than the previous date (Jan 7th).
2.3.1 :039 > d2 = DateTime.parse('2017-01-09 00:00:00.000000')
=> Mon, 09 Jan 2017 00:00:00 +0000
2.3.1 :040 > 3.business_days.after(d2)
=> Thu, 12 Jan 2017 09:00:00 +0000
I'm guessing this has something to do with the time. Seems like a bug, or am I missing something?
@ryancrisp It's a known 'issue' which was discussed some time ago, see: https://github.com/bokmann/business_time/pull/116. As you can see, numerous issues have been opened to address this rather unintuitive behaviour but it doesn't seem like it's going to be changed anytime soon.
this is different than #116 and seems like a real bug. both of your test cases should result in the Thursday date.
will investigate.