diff --git a/apps/api/src/broker/expand.ts b/apps/api/src/broker/expand.ts index 2c003f8..e052b23 100644 --- a/apps/api/src/broker/expand.ts +++ b/apps/api/src/broker/expand.ts @@ -209,8 +209,13 @@ export function expandOccurrences( const allDay: boolean = dtstart.isDate const uid: string = event.uid ?? '' - const rangeStart = ICAL.Time.fromJSDate(windowStart, false) - const rangeEnd = ICAL.Time.fromJSDate(windowEnd, false) + // useUTC=true: windowStart/windowEnd are absolute instants (midnight-UTC of the + // requested dates). Interpreting them in UTC keeps the occurrence-window comparison + // absolute. With useUTC=false ical.js used the SERVER's local timezone, shifting the + // window by the server's offset and dropping evening occurrences near the window end + // (e.g. a 17:45-04:00 event = 21:45Z fell past a day window whose end was shifted to 20:00). + const rangeStart = ICAL.Time.fromJSDate(windowStart, true) + const rangeEnd = ICAL.Time.fromJSDate(windowEnd, true) const occurrences: CalendarOccurrence[] = []