mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Fix bug when changing schedule end time and end is before start.
This commit is contained in:
@@ -59,8 +59,15 @@ data class NotificationProfileSchedule(
|
||||
return LocalTime.of(end / 100, end % 100)
|
||||
}
|
||||
|
||||
fun endDateTime(now: LocalDateTime): LocalDateTime {
|
||||
return end.toLocalDateTime(now).plusDays(if (end < start) 1 else 0)
|
||||
fun endDateTime(localNow: LocalDateTime): LocalDateTime {
|
||||
val localStart: LocalDateTime = start.toLocalDateTime(localNow)
|
||||
val localEnd: LocalDateTime = end.toLocalDateTime(localNow)
|
||||
|
||||
return if (end < start && (daysEnabled.contains(localStart.dayOfWeek) && localNow.isBetween(localStart, localEnd.plusDays(1)))) {
|
||||
localEnd.plusDays(1)
|
||||
} else {
|
||||
localEnd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user