Fix notification profile disable bug.

Fixes #11892
This commit is contained in:
Cody Henthorne
2022-01-12 12:24:52 -05:00
parent 89b918fbd2
commit 50b37e0402
2 changed files with 20 additions and 2 deletions

View File

@@ -51,8 +51,15 @@ data class NotificationProfileSchedule(
return LocalTime.of(start / 100, start % 100)
}
fun startDateTime(now: LocalDateTime): LocalDateTime {
return start.toLocalDateTime(now)
fun startDateTime(localNow: LocalDateTime): LocalDateTime {
val localStart: LocalDateTime = start.toLocalDateTime(localNow)
val localEnd: LocalDateTime = end.toLocalDateTime(localNow)
return if (end < start && (daysEnabled.contains(localStart.dayOfWeek.minus(1)) && localNow.isBetween(localStart.minusDays(1), localEnd))) {
localStart.minusDays(1)
} else {
localStart
}
}
fun endTime(): LocalTime {