fix: dynamic event length change on reschedule (#14110)
* fixed dynamic event length change on reschedule * fixed dynamic event length change on reschedule * Update get-booking.ts Type check: added endTime * Update get-booking.ts * Fix: typeCheck error * Revert yarn.lock to its state before unintended changes
This commit is contained in:
@@ -282,7 +282,17 @@ export const useBookerStore = create<BookerStore>((set, get) => ({
|
||||
// if the user reschedules a booking right after the confirmation page.
|
||||
// In that case the time would still be store in the store, this way we
|
||||
// force clear this.
|
||||
if (rescheduleUid && bookingData) set({ selectedTimeslot: null });
|
||||
// Also, fetch the original booking duration if user is rescheduling and
|
||||
// update the selectedDuration
|
||||
if (rescheduleUid && bookingData) {
|
||||
set({ selectedTimeslot: null });
|
||||
const originalBookingLength = dayjs(bookingData?.endTime).diff(
|
||||
dayjs(bookingData?.startTime),
|
||||
"minutes"
|
||||
);
|
||||
set({ selectedDuration: originalBookingLength });
|
||||
updateQueryParam("duration", originalBookingLength ?? "");
|
||||
}
|
||||
if (month) set({ month });
|
||||
|
||||
if (isInstantMeeting) {
|
||||
|
||||
@@ -54,6 +54,7 @@ async function getBooking(prisma: PrismaClient, uid: string, isSeatedEvent?: boo
|
||||
id: true,
|
||||
uid: true,
|
||||
startTime: true,
|
||||
endTime: true,
|
||||
description: true,
|
||||
customInputs: true,
|
||||
responses: true,
|
||||
@@ -85,6 +86,7 @@ async function getBooking(prisma: PrismaClient, uid: string, isSeatedEvent?: boo
|
||||
// @NOTE: had to do this because Server side cant return [Object objects]
|
||||
// probably fixable with json.stringify -> json.parse
|
||||
booking["startTime"] = (booking?.startTime as Date)?.toISOString() as unknown as Date;
|
||||
booking["endTime"] = (booking?.endTime as Date)?.toISOString() as unknown as Date;
|
||||
}
|
||||
|
||||
return booking;
|
||||
@@ -223,6 +225,7 @@ export const getBookingForSeatedEvent = async (uid: string) => {
|
||||
id: true,
|
||||
uid: true,
|
||||
startTime: true,
|
||||
endTime: true,
|
||||
attendees: {
|
||||
select: {
|
||||
id: true,
|
||||
@@ -254,6 +257,7 @@ export const getBookingForSeatedEvent = async (uid: string) => {
|
||||
...booking,
|
||||
// @NOTE: had to do this because Server side cant return [Object objects]
|
||||
startTime: booking.startTime.toISOString() as unknown as Date,
|
||||
endTime: booking.endTime.toISOString() as unknown as Date,
|
||||
description: null,
|
||||
customInputs: null,
|
||||
responses: {},
|
||||
|
||||
Reference in New Issue
Block a user