Setting up overnight time range for a routine (9:00 PM-2:00 AM) results in the apps being blocked all day (after 2:00 AM). Switching the routine off and on results in it fixing itself, but I'm not sure if it'll start blocking apps properly at 9 PM again.
To fix you need to compare start_time and the end_time the other way. When value of end < start, the range crosses midnight. Add one full day before subtracting. Like in my case you want to schedule for only 5h, making it duration=(end−start+24).
Setting up overnight time range for a routine (9:00 PM-2:00 AM) results in the apps being blocked all day (after 2:00 AM). Switching the routine off and on results in it fixing itself, but I'm not sure if it'll start blocking apps properly at 9 PM again.
To fix you need to compare
start_timeand theend_timethe other way. When value of end < start, the range crosses midnight. Add one full day before subtracting. Like in my case you want to schedule for only 5h, making itduration=(end−start+24).