You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
eta(x) = x if x is during business hours
eta(x) = next business day otherwise
Let's say my business hours go from monday to friday until 18:00
So to implement it, I was doing this: 0.business_days.after(now) which works correctly in almost every case.
However when on a weekend (either saturday or sunday) after 18, (say for example Sun, 31 May 2020 at 18:29) the expected result is to return the next day (Mon, 01 Jun 2020) but the actual output is a day off (Tue, 02 Jun 2020).
Am I missing something?
The text was updated successfully, but these errors were encountered:
The issue is this method. Basically, the roll forward logic is buggy and it fast forwards to Monday after business, in your case, and then applies another roll-forward which pushes the day to Tuesday. I don't see much activity here, so you'll probably have to fork and patch, or deal with it in your client code.
To fix it in your client code, you can use Time.first_business_day(day), on weekends, which appears to give the correct result, except if the start is Friday after business, in which case you'll want to push the day forward by one before calling the above.
Alternatively, depending on your use case, you may be able to push the time into the business hours window and that may also fix the issue.
This sounds more like you might be running into a time zone issue -- i.e. when the the time in UTC has actually rolled over to the next day but you might be expecting the date math to run under your local time zone.
Possibly, it sounds like you're using busines_days instead of business_hours to calculate your business logic:
I have the following business logic:
eta(x) = x if x is during business hours
eta(x) = next business day otherwise
Let's say my business hours go from monday to friday until 18:00
So to implement it, I was doing this:
0.business_days.after(now)
which works correctly in almost every case.However when on a weekend (either saturday or sunday) after 18, (say for example Sun, 31 May 2020 at 18:29) the expected result is to return the next day (Mon, 01 Jun 2020) but the actual output is a day off (Tue, 02 Jun 2020).
Am I missing something?
The text was updated successfully, but these errors were encountered: