Find the next busniess day during work hours
Closed this issue · 2 comments
Hey,
Not sure this is an issue or by design, but once try get next busniess day during work hours, you get today busniess day instead of the next day.
for example,
if your busniess day on 2016/1/8 is from 08:00 am till 16:00pm
Biz.time(0, :hours).after(Time.utc(2016, 1, 8, 20))
will give you next busniess day 2016/2/8 as expected but:
Biz.time(0, :hours).after(Time.utc(2016, 1, 8, 14))
will give you 2016/1/8 date which is toda'y date. actually I expected to get the next busniess day anyway:)
If this is a by design issue, so my bad and this is just a question of how can I get next busniess day during work hours?
I end up with this workaround:
biz.periods.after(Time.now).timeline.until(Time.now + 2.week).to_a[1].start_time
Hey, @megetron!
If you're looking only for the date, I'd suggest:
Biz.dates.days(1).after(Time.now)
If you're looking for the first time in business hours on a particular day, I'd suggest:
Biz.periods.on((Time.now + 2.weeks).to_date).first.start_time
or, if you need to look forward based on a number of days with business hours:
Biz.periods.on(Biz.dates.days(10).after(Time.now)).first.start_time