diff --git a/apps/web/pages/[user]/calendar-cache/[month].tsx b/apps/web/pages/[user]/calendar-cache/[month].tsx index 9cd9359bb5..b8b4acb7d6 100644 --- a/apps/web/pages/[user]/calendar-cache/[month].tsx +++ b/apps/web/pages/[user]/calendar-cache/[month].tsx @@ -3,15 +3,13 @@ * caching system that NextJS uses SSG pages. * TODO: Redirect to user profile on browser */ -import type { GetStaticPaths, GetStaticProps } from "next"; +import type { GetStaticPaths, GetStaticProps, InferGetStaticPropsType } from "next"; import { z } from "zod"; import { getCachedResults } from "@calcom/core"; import dayjs from "@calcom/dayjs"; import prisma from "@calcom/prisma"; -const CalendarCache = () =>
; - const paramsSchema = z.object({ user: z.string(), month: z.string() }); export const getStaticProps: GetStaticProps< { results: Awaited{JSON.stringify(props, null, " ")}: ; export default CalendarCache; diff --git a/packages/core/CalendarManager.ts b/packages/core/CalendarManager.ts index 99bc55240e..592ff2cb5d 100644 --- a/packages/core/CalendarManager.ts +++ b/packages/core/CalendarManager.ts @@ -231,7 +231,11 @@ export const getBusyCalendarTimes = async ( const months = getMonths(dateFrom, dateTo); try { if (coldStart) { - results = await getCachedResults(withCredentials, dateFrom, dateTo, selectedCalendars); + // Subtract 11 hours from the start date to avoid problems in UTC- time zones. + const startDate = dayjs(dateFrom).subtract(11, "hours").format(); + // Add 14 hours from the start date to avoid problems in UTC+ time zones. + const endDate = dayjs(dateTo).endOf("month").add(14, "hours").format(); + results = await getCachedResults(withCredentials, startDate, endDate, selectedCalendars); logger.info("Generating calendar cache in background"); // on cold start the calendar cache page generated in the background Promise.all(months.map((month) => createCalendarCachePage(username, month)));