bokmann / business_time

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

Wrong Result or unexpected not-business day ? #195

Closed Vin0uz closed 4 years ago

Vin0uz commented 4 years ago

It happened sometime that the computation turned out to be wrong..

For example :

date = Tue, 01 Oct 2019 20:00:00 +0000
2.business_days.after(date)
=> Fri, 04 Oct 2019 09:00:00 +0000

Note : It is possible that I am not aware of an existing holiday ^^'

Vin0uz commented 4 years ago

Found the problem, noting it here in case somebody ever face same issue..

Seems very obvious now that I noted it, 🤦‍♂ but in fact here was the problem:

There was no config file, so it was using default one, with default working-hours.

So if you run business_days.after(datetime) and datetime is out of working hours, it will add time to reach the next working slot.