Fix event recursion end date not being respected when calendar loads#90
Draft
Fix event recursion end date not being respected when calendar loads#90
Conversation
Co-authored-by: muskie9 <870751+muskie9@users.noreply.github.com>
Co-authored-by: muskie9 <870751+muskie9@users.noreply.github.com>
Co-authored-by: muskie9 <870751+muskie9@users.noreply.github.com>
Co-authored-by: muskie9 <870751+muskie9@users.noreply.github.com>
Co-authored-by: muskie9 <870751+muskie9@users.noreply.github.com>
Co-authored-by: muskie9 <870751+muskie9@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix event recursion end date not respected
Fix event recursion end date not being respected when calendar loads
Oct 16, 2025
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.
Problem
When setting up a recurring event with a
RecursionEndDate, additional event instances were displayed after the configured end date when the calendar loaded. For example, a weekly meeting configured to end on July 14, 2025 would continue to show occurrences through the end of the year.Root Cause
In
src/Traits/CarbonRecursion.php, thecreateCarbonPeriod()method only used the event'sRecursionEndDatewhen no range end was provided by the caller. WhenCalendar->getEventsFeed()requests events with a date range (typically a 2-year window by default), this range parameter would completely override the event'sRecursionEndDate, causing occurrences to be generated beyond the intended end date.The problematic logic was:
This meant
RecursionEndDatewas ignored whenever a range end was provided.Solution
Refactored the logic to always respect
RecursionEndDateby taking the earlier of the requested range end and the event's recursion end date:This ensures that even when a broader date range is requested, event occurrences will never extend beyond the configured
RecursionEndDate.Changes
Core Fix
src/Traits/CarbonRecursion.phpcreateCarbonPeriod()method to enforceRecursionEndDatemin()instance method for clean date comparisonComprehensive Test Coverage
tests/CarbonRecursionTest.phptestRecursionEndDateIsRespected()- validates weekly recurring eventstestDailyRecursionEndDateIsRespected()- validates daily recurring eventstestMonthlyRecursionEndDateIsRespected()- validates monthly recurring eventsEach test method:
RecursionEndDatesetRecursionEndDateRecursionEndDateImpact
RecursionEndDatecontinue to work as beforeExample
Before Fix:
After Fix:
Closes #[issue-number]
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/Behat/Gherkin/zipball/cc3a7e224b36373be382b53ef02ede0f1807bb58/usr/bin/php8.3 -n -c /tmp/2ZCqj0 /usr/bin/composer install(http block)https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936/usr/bin/php8.3 -n -c /tmp/2ZCqj0 /usr/bin/composer install(http block)https://api.github.com/repos/phpstan/phpstan/zipball/ead89849d879fe203ce9292c6ef5e7e76f867b96/usr/bin/php8.3 -n -c /tmp/2ZCqj0 /usr/bin/composer install(http block)https://api.github.com/repos/silverstripe/recipe-plugin/zipball/57d785dba26370ad9b981871411930ccca1dbffd/usr/bin/php8.3 -n -c /tmp/2ZCqj0 /usr/bin/composer install(http block)https://api.github.com/repos/silverstripe/vendor-plugin/zipball/b9c18fa8488188908935c6a71222b637f3cfe64b/usr/bin/php8.3 -n -c /tmp/2ZCqj0 /usr/bin/composer install(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #89
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.