Files
calendar/packages/features/calendar-cache/lib/datesForCache.ts
T
2024-12-17 19:20:19 +00:00

17 lines
532 B
TypeScript

/** Expand the start date to the beginning of the current month */
export const getTimeMin = (timeMin?: string) => {
const date = timeMin ? new Date(timeMin) : new Date();
date.setDate(1);
date.setHours(0, 0, 0, 0);
return date.toISOString();
};
/** 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() + 1);
date.setDate(0);
date.setHours(0, 0, 0, 0);
return date.toISOString();
}