Add support for time zones when calculating alarm trigger times#348
Merged
Conversation
Without a start time `Reminders.MINUTES` will always contain -1
Contributor
There was a problem hiding this comment.
Pull request overview
Adds time zone–aware alarm trigger minute calculations and centralizes end-time derivation for tasks, aligning alarm handling more closely with RFC5545 requirements and improving DST correctness.
Changes:
- Introduces
AlarmTriggerCalculator.alarmTriggerToMinutes()to compute alarm offsets with time zone/DST-aware behavior (including forPeriodtriggers). - Adds
Task.endto derive an effective task end (DUEorDTSTART + DURATION) and updates task alarm mapping to use it. - Updates calendar/task builders and tests to pass required reference start/end times and validates behavior with new/adjusted test coverage.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/src/main/kotlin/at/bitfire/synctools/util/AlarmTriggerCalculator.kt | New shared implementation for alarm trigger offset calculation with time zone/DST support. |
| lib/src/main/kotlin/at/bitfire/ical4android/Task.kt | Adds Task.end helper for deriving an effective end date from due/start+duration. |
| lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/DmfsTaskBuilder.kt | Switches task alarm minute calculation to AlarmTriggerCalculator and uses task.end. |
| lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/builder/RemindersBuilder.kt | Switches event reminder minute calculation to AlarmTriggerCalculator and derives end via getEndDate(true). |
| lib/src/main/kotlin/at/bitfire/ical4android/ICalendar.kt | Removes the old vAlarmToMin helper now replaced by AlarmTriggerCalculator. |
| lib/src/test/kotlin/at/bitfire/synctools/util/AlarmTriggerCalculatorTest.kt | New focused unit tests for alarm trigger minute calculation, including DST/time zone scenarios. |
| lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/builder/RemindersBuilderTest.kt | Updates tests to include required DTSTART references and validate reminder mapping behavior. |
| lib/src/test/kotlin/at/bitfire/ical4android/TaskTest.kt | Adds test coverage for Task.end across temporal types and DST boundaries. |
| lib/src/test/kotlin/at/bitfire/ical4android/ICalendarTest.kt | Removes vAlarmToMin-specific tests that moved to AlarmTriggerCalculatorTest. |
rfc2822
approved these changes
May 11, 2026
…culation # Conflicts: # lib/src/main/kotlin/at/bitfire/synctools/mapping/tasks/DmfsTaskBuilder.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unfortunately, this is a rather large pull request. However, the bulk of it is just moving things around, (hopefully) without changing the behavior. These commits are prefixed with
[Refactor].The functional changes are:
Task.end(for calendar eventsVEvent.getEndDate()was already doing all the work).AlarmTriggerCalculator.alarmTriggerToMinutes()(previouslyICalendar.vAlarmToMin()) to support time zones when calculating alarm trigger times