The final check is start_hour <= hour < end_hour, so a window whose start is after its end is never satisfied:
is_business_hours(dt, start_hour=20, end_hour=8)
22:00 Mon -> False 02:00 Tue -> False 12:00 Mon -> False
Validation accepts any hour in 0-23 for both, so an after-hours or on-call window is configured happily and then never fires. A workflow gated on it does nothing and reports nothing.
Two ways to read this, and they lead to different fixes:
- A start after the end means the window wraps midnight.
20-8 is the night shift. This makes an existing config start working.
- It is a configuration error and should raise, the way
in_range refuses a reversed interval.
I lean towards the first, since the second still leaves no way to express a night window and the docstring does not say the window has to sit inside one day. Happy to write whichever you prefer.
The final check is
start_hour <= hour < end_hour, so a window whose start is after its end is never satisfied:Validation accepts any hour in 0-23 for both, so an after-hours or on-call window is configured happily and then never fires. A workflow gated on it does nothing and reports nothing.
Two ways to read this, and they lead to different fixes:
20-8is the night shift. This makes an existing config start working.in_rangerefuses a reversed interval.I lean towards the first, since the second still leaves no way to express a night window and the docstring does not say the window has to sit inside one day. Happy to write whichever you prefer.