Fix recurring event dtstart anchoring to end time instead of start time - #181
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RecurringEvent::rule()always anchored the RRULE at$this->end()(the event's start date with its end time), ignoring the$useEndflag that already existed on the method. For a recurring event with no explicitstart_time/end_timeset 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 queriedfromboundary.Events::calendar()builds the grid viamakeEmptyDates($from, $to)->merge($occurrences). Since the leaked occurrence's date isn't a key inmakeEmptyDates,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$useEndparameter:dtstartis$this->start()by default, and$this->end()only when$useEndis explicitly true (used bynextOccurrences(), unchanged).Test plan
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