From 437ecd10239c70e5a8c4d34119076ab155a2159e Mon Sep 17 00:00:00 2001 From: Meier Lukas Date: Sun, 25 May 2025 14:51:26 +0200 Subject: [PATCH] fix(calendar): load events for all visible days of calendar month (#3216) --- packages/request-handler/src/calendar.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/request-handler/src/calendar.ts b/packages/request-handler/src/calendar.ts index 55918eaaf..dd198912a 100644 --- a/packages/request-handler/src/calendar.ts +++ b/packages/request-handler/src/calendar.ts @@ -13,8 +13,10 @@ export const calendarMonthRequestHandler = createCachedIntegrationRequestHandler >({ async requestAsync(integration, input) { const integrationInstance = await createIntegrationAsync(integration); - const startDate = dayjs().year(input.year).month(input.month).startOf("month"); - const endDate = startDate.clone().endOf("month"); + // Calendar component shows up to 6 days before and after the month, for example if 1. of january is sunday, it shows the last 6 days of december. + const startDate = dayjs().year(input.year).month(input.month).startOf("month").subtract(6, "days"); + const endDate = dayjs().year(input.year).month(input.month).endOf("month").add(6, "days"); + return await integrationInstance.getCalendarEventsAsync( startDate.toDate(), endDate.toDate(),