businesstime icon indicating copy to clipboard operation
businesstime copied to clipboard

Timedelta to businesshours support

Open csoare7 opened this issue 6 years ago • 1 comments

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?

csoare7 avatar Oct 31 '17 11:10 csoare7