mirror of
https://github.com/nikdoof/businesshours.git
synced 2026-01-31 09:28:14 +00:00
Fix Python 2.6 support.
This commit is contained in:
@@ -33,8 +33,8 @@ def calc_business_hours(start, end, weekdays=(1, 2, 3, 4, 5), hours=range(8, 18)
|
|||||||
if end.time().hour <= hours[0]:
|
if end.time().hour <= hours[0]:
|
||||||
return 0
|
return 0
|
||||||
actual_end = datetime.combine(end.date(), time(hours[-1] + 1, 0, 0))
|
actual_end = datetime.combine(end.date(), time(hours[-1] + 1, 0, 0))
|
||||||
secs = (actual_end - actual_start).total_seconds()
|
delta = (actual_end - actual_start)
|
||||||
return secs
|
return delta.seconds + (delta.days * 24 * 3600)
|
||||||
else:
|
else:
|
||||||
total_seconds = 0
|
total_seconds = 0
|
||||||
dates = [dt for dt in date_range(start, end)]
|
dates = [dt for dt in date_range(start, end)]
|
||||||
|
|||||||
Reference in New Issue
Block a user