Skip to content

fix: read the TZID of each RDATE in EventIterator - #821

Open
jvelo wants to merge 4 commits into
sabre-io:masterfrom
jvelo:fix/rdate-tzid
Open

jvelo wants to merge 4 commits into
sabre-io:masterfrom
jvelo:fix/rdate-tzid

Conversation

@jvelo

@jvelo jvelo commented Nov 26, 2026 •

Copy link
Copy Markdown

Summary

Fixes #819.

Depends on #820. This branch contains the commits of #820. Merge #820 first. Without it, an RDATE in UTC that this PR moves to the timezone of DTSTART gets a wrong end when the instance crosses a DST transition.

EventIterator passed the raw RDATE values to RDateIterator, which parsed them in the timezone of DTSTART. The TZID of an RDATE had no effect, so the instance started at the wrong time.

  • EventIterator now reads the RDATE properties with getDateTimes(), as it already does for EXDATE. Each TZID is used. An RDATE without TZID still uses the timezone of DTSTART.
  • RDATE properties in different timezones can be out of order once converted, so the dates are sorted.
  • RDateIterator accepts DateTimeInterface values in addition to strings, and gives them in the timezone of the start date.
  • RDATE;VALUE=PERIOD keeps the current behaviour (see RDATE PERIOD with TZID doesn't seem to be recognised #601).

Related: #347 and #716 (RDATE together with RRULE) are separate.

Tests

RDateTimezoneTest covers one RDATE with a TZID, several RDATE properties in different timezones (checking the order after conversion), UTC with a TZID, no TZID, and all-day dates. RDateIteratorTest covers DateTimeInterface values. testEndAcrossDst checks that a UTC RDATE keeps the exact duration of the event across DST; it fails without #820. Without the change, the 5 new cases about TZID fail; the other 2 check that nothing else changes. The full suite, phpstan and php-cs-fixer pass.

getDtEnd() added the duration in seconds with modify(), which uses the
clock time. Across a DST transition, the end was wrong.

With DTEND, each instance now has the exact duration of the master
event. With DURATION, the nominal duration is added to each start, as
RFC 5545, section 3.8.5.3, requires.

Fixes sabre-io#818.
Add winter time cases for P1D and PT24H, a mixed P1DT2H case,
and floating and all-day events with a reference timezone.
EventIterator passed the raw RDATE values to RDateIterator, which
parsed them in the timezone of DTSTART. The TZID of an RDATE had no
effect.

EventIterator now uses getDateTimes(), as for EXDATE, and sorts the
dates. RDateIterator accepts DateTimeInterface values and gives them in
the timezone of the start date. An RDATE without TZID still uses the
timezone of DTSTART. RDATE with VALUE=PERIOD keeps the old behaviour.

Fixes sabre-io#819.
@jvelo
jvelo marked this pull request as ready for review November 26, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EventIterator ignores the TZID of an RDATE

1 participant