File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed
lib/src/main/kotlin/at/bitfire/synctools/mapping/calendar/handler Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -35,15 +35,14 @@ class DurationHandler(
3535 override fun process (from : Entity , main : Entity , to : VEvent ) {
3636 val values = from.entityValues
3737
38- /* Skip if:
39- - DTEND is set – we don't need to process DURATION anymore.
40- - DURATION is not set – then usually DTEND is set; however it's also OK to have neither DTEND nor DURATION in a VEVENT. */
38+ /* Skip if DTEND is set and/or DURATION is not set. In both cases EndTimeHandler is
39+ responsible for generating the DTEND property. */
4140 if (values.getAsLong(Events .DTEND ) != null )
4241 return
4342 val durationStr = values.getAsString(Events .DURATION ) ? : return
44- val parsedDuration = AndroidTimeUtils .parseDuration(durationStr)
4543
46- // invert in case of negative duration (events can't go back in time)
44+ // parse duration and invert in case of negative value (events can't go back in time)
45+ val parsedDuration = AndroidTimeUtils .parseDuration(durationStr)
4746 val duration = parsedDuration.abs()
4847
4948 /* Some servers have problems with DURATION. For maximum compatibility, we always generate DTEND instead of DURATION.
Original file line number Diff line number Diff line change @@ -42,13 +42,14 @@ class EndTimeHandler(
4242 val durationStr = values.getAsString(Events .DURATION )
4343
4444 if (tsEndOrNull == null && durationStr != null ) // DTEND not present, but DURATION is present:
45- return // DurationHandler is responsible
45+ return // DurationHandler is responsible for generating the DTEND property
4646
4747 /* Make sure that there's always a DTEND for compatibility. While it's allowed in RFC 5545
48- to omit DTEND, this causes problems with some servers (notably iCloud). */
48+ to omit DTEND, this causes problems with some servers (notably iCloud). See also:
49+ https://github.com/bitfireAT/davx5-ose/issues/1859 */
4950 val tsEnd = tsEndOrNull
5051 ?.takeUnless { it < tsStart } // only use DTEND if it's not before DTSTART
51- ? : calculateFromDefault(tsStart, allDay) // for compatibility
52+ ? : calculateFromDefault(tsStart, allDay) // always provide DTEND for compatibility
5253
5354 // DATE or DATE-TIME according to allDay
5455 val end = AndroidTimeField (
You can’t perform that action at this time.
0 commit comments