From ae7bbaf4149011b658f43f2eeb8d84adfcc3ae84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Omar=20L=C3=B3pez?= Date: Tue, 17 Dec 2024 12:20:19 -0700 Subject: [PATCH] fix: calendar cache date ranges (#18237) Co-authored-by: Keith Williams --- packages/app-store/googlecalendar/lib/CalendarService.ts | 4 ++-- packages/features/calendar-cache/lib/datesForCache.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/app-store/googlecalendar/lib/CalendarService.ts b/packages/app-store/googlecalendar/lib/CalendarService.ts index 6e43f151dc..a203a3bb3f 100644 --- a/packages/app-store/googlecalendar/lib/CalendarService.ts +++ b/packages/app-store/googlecalendar/lib/CalendarService.ts @@ -724,9 +724,9 @@ export default class GoogleCalendarService implements Calendar { async fetchAvailabilityAndSetCache(selectedCalendars: IntegrationCalendar[]) { const parsedArgs = { /** Expand the start date to the start of the month */ - timeMin: getTimeMax(), + timeMin: getTimeMin(), /** Expand the end date to the end of the month */ - timeMax: getTimeMin(), + timeMax: getTimeMax(), items: selectedCalendars.map((sc) => ({ id: sc.externalId })), }; const data = await this.fetchAvailability(parsedArgs); diff --git a/packages/features/calendar-cache/lib/datesForCache.ts b/packages/features/calendar-cache/lib/datesForCache.ts index 2b90066371..6eecb0db90 100644 --- a/packages/features/calendar-cache/lib/datesForCache.ts +++ b/packages/features/calendar-cache/lib/datesForCache.ts @@ -9,7 +9,7 @@ export const getTimeMin = (timeMin?: string) => { /** Expand the end date to the end of the next month */ export function getTimeMax(timeMax?: string) { const date = timeMax ? new Date(timeMax) : new Date(); - date.setMonth(date.getMonth() + 2); + date.setMonth(date.getMonth() + 1); date.setDate(0); date.setHours(0, 0, 0, 0); return date.toISOString();