Skip to content

Fix recurring event dtstart anchoring to end time instead of start time - #181

Merged
edalzell merged 1 commit into
mainfrom
fix-recurring-event-dtstart
Aug 6, 2026
Merged

Fix recurring event dtstart anchoring to end time instead of start time#181
edalzell merged 1 commit into
mainfrom
fix-recurring-event-dtstart

Conversation

@edalzell

@edalzell edalzell commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

RecurringEvent::rule() always anchored the RRULE at $this->end() (the event's start date with its end time), ignoring the $useEnd flag that already existed on the method. For a recurring event with no explicit start_time/end_time set in a timezone offset from the app's default (e.g. America/Los_Angeles), this could produce an RRULE occurrence dated one day before the queried from boundary.

Events::calendar() builds the grid via makeEmptyDates($from, $to)->merge($occurrences). Since the leaked occurrence's date isn't a key in makeEmptyDates, merge() appended it at the end of the collection instead of dropping it — surfacing as a stray, unwrapped day-cell rendered after the last week row in the calendar view.

Approach

rule() now respects its own $useEnd parameter: dtstart is $this->start() by default, and $this->end() only when $useEnd is explicitly true (used by nextOccurrences(), unchanged).

Test plan

  • Added a test reproducing the bug (calendar does not leak a stray day for a daily recurring event with no explicit times) — fails on the old code (43 entries, one out of week-boundary sequence), passes with the fix
  • Full test suite passes (120/120)

RecurringEvent::rule() always anchored the RRULE at $this->end() regardless
of the $useEnd flag, so recurring events with no explicit start/end time
in a non-UTC timezone could produce an occurrence a day before the queried
range. Events::calendar() then appended that stray occurrence outside the
week grid instead of dropping it.
@edalzell
edalzell marked this pull request as ready for review August 6, 2026 19:25
@edalzell edalzell added the fix label Aug 6, 2026
@edalzell
edalzell merged commit 1836fc1 into main Aug 6, 2026
@edalzell
edalzell deleted the fix-recurring-event-dtstart branch August 6, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant