fix: calendar cache date ranges (#18237)
Co-authored-by: Keith Williams <keithwillcode@gmail.com>
This commit is contained in:
co-authored by
Keith Williams
parent
4df4383e1e
commit
ae7bbaf414
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user