-
Notifications
You must be signed in to change notification settings - Fork 3
Always generate DTEND for compatibility #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Update `AndroidTimeField` to handle null time zones - Add `calculateFromDefault` method in `EndTimeHandler` - Modify `DurationHandler` to skip if DTEND is present
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR ensures that DTEND is always generated in iCalendar events for compatibility with servers like iCloud that have issues when DTEND is omitted. The implementation adds fallback logic to generate default DTEND values when neither DTEND nor DURATION are provided.
Key changes:
- Modified
EndTimeHandlerto always generate DTEND by calculating defaults when not provided (PT1D for all-day events, PT0S for non-all-day events) - Updated
DurationHandlerto take absolute value of negative durations (events can't go back in time) - Enhanced test coverage for empty DTEND scenarios and negative duration handling
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| EndTimeHandler.kt | Added logic to always generate DTEND by computing defaults from DTSTART when DTEND is missing and DURATION is not present; includes calculateFromDefault() helper method |
| DurationHandler.kt | Modified to handle negative durations by taking absolute values; removed skip conditions for zero/negative durations |
| EndTimeHandlerTest.kt | Added tests for empty DTEND scenarios (all-day and non-all-day) and for the new calculateFromDefault() method |
| DurationHandlerTest.kt | Added comprehensive test coverage for negative durations (both all-day and non-all-day variations) |
| AndroidTimeField.kt | Updated documentation to clarify parameter descriptions with backticks for code formatting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/EndTimeHandlerTest.kt
Show resolved
Hide resolved
lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/EndTimeHandlerTest.kt
Show resolved
Hide resolved
lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/DurationHandlerTest.kt
Outdated
Show resolved
Hide resolved
lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/DurationHandlerTest.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
lib/src/test/kotlin/at/bitfire/synctools/mapping/calendar/handler/DurationHandlerTest.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This PR ensures that the iCalendar
DTENDis always generated (except whenDTSTARTis not set, which must not happen), even when the localDTENDis not set or the same asSTART.Fixes #153