Skip to content

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Dec 5, 2025

This PR ensures that the iCalendar DTEND is always generated (except when DTSTART is not set, which must not happen), even when the local DTEND is not set or the same as START.

Fixes #153

- Update `AndroidTimeField` to handle null time zones
- Add `calculateFromDefault` method in `EndTimeHandler`
- Modify `DurationHandler` to skip if DTEND is present
@rfc2822 rfc2822 self-assigned this Dec 5, 2025
@rfc2822 rfc2822 added the bug Something isn't working label Dec 5, 2025
Copy link
Contributor

Copilot AI left a 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 EndTimeHandler to always generate DTEND by calculating defaults when not provided (PT1D for all-day events, PT0S for non-all-day events)
  • Updated DurationHandler to 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.

@rfc2822 rfc2822 marked this pull request as ready for review December 5, 2025 13:02
@rfc2822 rfc2822 requested a review from a team as a code owner December 5, 2025 13:02
@rfc2822 rfc2822 requested a review from Copilot December 5, 2025 13:02
Copy link
Contributor

Copilot AI left a 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.

Copy link
Contributor

Copilot AI left a 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.

@rfc2822 rfc2822 merged commit 2cc77a5 into main Dec 5, 2025
13 checks passed
@rfc2822 rfc2822 deleted the always-generate-dtend branch December 5, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DTEND should always be generated for iCloud, even if it's the same as DTSTART

1 participant