Bug Description
When a recurring weekly event (e.g., "Monday Night Funk Jam" every Monday) is created via the AI upsert_event handler with a date range spanning multiple weeks, the calendar displays it on every single day in the range — including incorrect days (Tuesdays, Wednesdays, etc.).
Reproduction
- Create an event via
upsert_event (AI pipeline) with:
startDate: "2026-04-06" (Monday)
endDate: "2026-05-11" (Monday)
occurrenceDates: [] (empty)
- View the event on the calendar
- Event appears on all 36 days (Apr 6 through May 11) instead of only on Mondays
Root Cause
The DateGrouper::group_events_by_date() logic at inc/Blocks/Calendar/Grouping/DateGrouper.php:88-98:
if ( $has_occurrence_dates ) {
$event_dates = $occurrence_dates; // Use explicit dates
} elseif ( $is_multi_day ) {
$event_dates = MultiDayResolver::get_date_range( ... ); // ALL days in range
} else {
$event_dates = array( $start_date ); // Single day
}
When occurrenceDates is empty and startDate !== endDate, the event is treated as a continuous multi-day event (like a festival). MultiDayResolver::get_date_range() generates every calendar date between start and end — correct for festivals, wrong for weekly recurring events.
Contrast with Working Approach
The SingleRecurring handler (inc/Steps/EventImport/Handlers/SingleRecurring/SingleRecurring.php) creates one event per occurrence with startDate = endDate (single day), updated weekly by the pipeline. This works correctly.
Affected Event
- Post ID 163758 on events.extrachill.com: MONDAY NIGHT FUNK JAM at LO-Fi Brewing
- Created by:
upsert_event handler (flow_id 10, pipeline_id 3)
startDate: "2026-04-06", endDate: "2026-05-11", occurrenceDates: []
- Should only appear on 6 Mondays: Apr 6, 13, 20, 27, May 4, 11
Proposed Fix Options
Option A: Fix the upsert path
When the AI EventUpsert creates an event where:
startDate and endDate are different
- The span is >7 days
- The start and end fall on the same day of week
→ Automatically populate occurrenceDates with each recurrence date instead of treating it as a continuous multi-day range.
Option B: Add a "recurring pattern" attribute
Add a recurrencePattern block attribute (e.g., "weekly:monday") that the DateGrouper can use to expand only the correct days, similar to how iCal RRULE works.
Option C: Guard in DateGrouper
In DateGrouper, detect when a multi-day range spans weeks and the event only occurs on one day-of-week. This is fragile but would catch existing broken events.
Immediate Workaround
Manually set occurrenceDates on the block attributes to the correct dates.
Bug Description
When a recurring weekly event (e.g., "Monday Night Funk Jam" every Monday) is created via the AI
upsert_eventhandler with a date range spanning multiple weeks, the calendar displays it on every single day in the range — including incorrect days (Tuesdays, Wednesdays, etc.).Reproduction
upsert_event(AI pipeline) with:startDate: "2026-04-06"(Monday)endDate: "2026-05-11"(Monday)occurrenceDates: [](empty)Root Cause
The
DateGrouper::group_events_by_date()logic atinc/Blocks/Calendar/Grouping/DateGrouper.php:88-98:When
occurrenceDatesis empty andstartDate !== endDate, the event is treated as a continuous multi-day event (like a festival).MultiDayResolver::get_date_range()generates every calendar date between start and end — correct for festivals, wrong for weekly recurring events.Contrast with Working Approach
The
SingleRecurringhandler (inc/Steps/EventImport/Handlers/SingleRecurring/SingleRecurring.php) creates one event per occurrence withstartDate = endDate(single day), updated weekly by the pipeline. This works correctly.Affected Event
upsert_eventhandler (flow_id 10, pipeline_id 3)startDate: "2026-04-06",endDate: "2026-05-11",occurrenceDates: []Proposed Fix Options
Option A: Fix the upsert path
When the AI
EventUpsertcreates an event where:startDateandendDateare different→ Automatically populate
occurrenceDateswith each recurrence date instead of treating it as a continuous multi-day range.Option B: Add a "recurring pattern" attribute
Add a
recurrencePatternblock attribute (e.g.,"weekly:monday") that theDateGroupercan use to expand only the correct days, similar to how iCal RRULE works.Option C: Guard in DateGrouper
In
DateGrouper, detect when a multi-day range spans weeks and the event only occurs on one day-of-week. This is fragile but would catch existing broken events.Immediate Workaround
Manually set
occurrenceDateson the block attributes to the correct dates.