Skip to content
New issue

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

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

Already on GitHub? # to your account

Timedelta to businesshours support #20

Open
csoare7 opened this issue Oct 31, 2017 · 1 comment
Open

Timedelta to businesshours support #20

csoare7 opened this issue Oct 31, 2017 · 1 comment

Comments

@csoare7
Copy link
Contributor

csoare7 commented Oct 31, 2017

First of all, thank you very much for your work on this library.

I found myself slightly confused when trying to extract business hours from the timedelta result.

>>> d1 = datetime.datetime(2017, 5, 23, 9, 0)
>>> d2 = datetime.datetime(2017, 5, 24, 9, 0)
>>> r = BusinessTime().businesstimedelta(d1, d2)
datetime.timedelta(1)

My immediate thought to extract the business hours (which in this case it's 8) was to call
timedelta.total_seconds() method on the result, but this will return the equivalent of 24 hours in seconds, not 8 hours - given it has no knowledge of the business_hours in the BusinessTime object.

This experience proved a bit confusing and was wondering if you might be able to suggest a solution to this? Would a PR would be accepted for this sort of functionality?

@josegonzalez
Copy link
Contributor

Go for it.

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

No branches or pull requests

2 participants