feat: date range overhaul (#9802)
Co-authored-by: CarinaWolli <[email protected]> Co-authored-by: Carina Wollendorfer <[email protected]> Co-authored-by: zomars <[email protected]> Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
10 files changed
+793
-179
No files matched your search
@@ -5,6 +5,7 @@ import type { Dayjs } from "@calcom/dayjs";
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { parseBookingLimit, parseDurationLimit } from "@calcom/lib";
|
||||
import { getWorkingHours } from "@calcom/lib/availability";
|
||||
import { buildDateRanges, subtract } from "@calcom/lib/date-ranges";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { checkBookingLimit } from "@calcom/lib/server";
|
||||
@@ -244,9 +245,22 @@ export async function getUserAvailability(
|
||||
};
|
||||
});
|
||||
|
||||
const dateRanges = buildDateRanges({
|
||||
dateFrom,
|
||||
dateTo,
|
||||
availability,
|
||||
timeZone,
|
||||
});
|
||||
|
||||
const formattedBusyTimes = bufferedBusyTimes.map((busy) => ({
|
||||
start: dayjs(busy.start),
|
||||
end: dayjs(busy.end),
|
||||
}));
|
||||
|
||||
return {
|
||||
busy: bufferedBusyTimes,
|
||||
timeZone,
|
||||
dateRanges: subtract(dateRanges, formattedBusyTimes),
|
||||
workingHours,
|
||||
dateOverrides,
|
||||
currentSeats,
|
||||
|
||||
Reference in new issue
Block a user