Move timed sub-tasks of an all-day routine in the device zone (#160)

This commit is contained in:
makiolaj committed 2026-11-18 21:00:19 +01:00
1 parent 3531e169cf
commit c835c13b49
3 files changed
+36 -8

No files matched your search

@@ -203,6 +203,23 @@ class SubtaskResetTest {
assertThat(moved - at("2026-10-26T08:00:00Z")).isEqualTo(at("2026-10-19T08:00:00Z") - at("2026-10-19T07:00:00Z"))
}
@Test
fun `a timed sub-task under an all-day routine keeps its local time across DST`() {
// A weekly all-day routine on Saturdays moves past the change to summer time in Berlin.
val shift = SeriesShift.of(at("2026-03-28T00:00:00Z"), at("2026-04-04T00:00:00Z"), isAllDay = true, timeZone = null, floating = berlin)
// Saturday 09:00 Berlin, still winter time, to the next Saturday 09:00, summer time.
assertThat(shift.apply(at("2026-03-28T08:00:00Z"), isAllDay = false)).isEqualTo(at("2026-04-04T07:00:00Z"))
assertThat(shift.apply(at("2026-03-29T00:00:00Z"), isAllDay = true)).isEqualTo(at("2026-04-05T00:00:00Z"))
}
@Test
fun `a provider series' shift reads an all-day one's timed sub-tasks in the device zone`() {
val before = mapOf<String, Any?>(Tasks.DUE to at("2026-03-28T00:00:00Z"), Tasks.IS_ALLDAY to 1L)
val after = mapOf<String, Any?>(Tasks.DUE to at("2026-04-04T00:00:00Z"), Tasks.IS_ALLDAY to 1L)
val shift = SubtaskReset.shiftOf(before, after, floating = berlin)!!
assertThat(shift.apply(at("2026-03-28T08:00:00Z"), isAllDay = false)).isEqualTo(at("2026-04-04T07:00:00Z"))
}
@Test
fun `an all-day sub-task follows the routine's change of date, also on a step under a day`() {
// An eight-hourly routine moves from 20:00 to 04:00 the next day in Berlin.