Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time delta calculation bug when both start and end times are after hours #13

Closed
brox opened this issue Jun 18, 2016 · 2 comments
Closed

Comments

@brox
Copy link

brox commented Jun 18, 2016

This piece of code returns the wrong time delta:

>>> bt=BusinessTime()
>>> bt.businesstimedelta(datetime(2016, 6, 17, 18), datetime(2016, 6, 20, 18))
datetime.timedelta(0)

The start time is after hours on a Friday at 6pm, while the end time is after hours on the following Monday at 6pm. The correct answer should be datetime.timedelta(1), right?

@flc
Copy link

flc commented Jun 22, 2016

assuming bt.business_hours is (datetime.time(9, 0), datetime.time(17, 0)) and bt.weekends is (5, 6)shouldn't this be equal to bt.businesstimedelta(datetime.datetime(2016, 6, 20, 9, 0), datetime.datetime(2016, 6, 20, 17, 0)) ?
which is:
datetime.timedelta(0, 28800)

@josegonzalez
Copy link
Contributor

Closed by #22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants