Quiet hours, 10 PM to 8 AM. At 11:30 PM, the marketing push buzzes.
transcript
Your user set quiet hours. 10 PM to 8 AM. At 11:30 PM, a marketing push buzzes their phone.
Quiet hours start at 10 PM. They end at 8 AM. It's 11:30 PM in their time zone. Clearly quiet hours. And yet.
The code asks: is now between start and end? After 10 PM, and before 8 AM? No time is both. The window crosses midnight. So it's never quiet hours. The push goes out. The fix: when start is after end, the window is overnight. Then the check is: after the start, or before the end. At 11:30, true.
Now a marketing message at 11:30. It isn't critical. So only the quiet channels survive. Email and in-app. No buzz. A suspicious login, though, is critical. It bypasses quiet hours. Push and SMS.
Any time window can cross midnight. Test that one first. Start after end? It's after the start, or before the end.
Full breakdown in the lecture.