fix: fix wrong dates on OOO edit dialog (#17736)
* fix: fix wrong dates on OOO edit dialog * do not use utc() on the browser side
This commit is contained in:
1 parent
757e3a2faf
commit
997d6a75e8
3 files changed
+12
-11
No files matched your search
@@ -155,8 +155,8 @@ export const outOfOfficeCreateOrUpdate = async ({ ctx, input }: TBookingRedirect
|
||||
if (existingOutOfOfficeEntry) {
|
||||
throw new TRPCError({ code: "BAD_REQUEST", message: "booking_redirect_infinite_not_allowed" });
|
||||
}
|
||||
const startDateUtc = dayjs.utc(startDate).add(input.offset, "minute");
|
||||
const endDateUtc = dayjs.utc(endDate).add(input.offset, "minute");
|
||||
const startTimeUtc = dayjs.utc(startDate).add(input.offset, "minute").startOf("day").toISOString();
|
||||
const endTimeUtc = dayjs.utc(endDate).add(input.offset, "minute").endOf("day").toISOString();
|
||||
|
||||
// Get the existing redirected user from existing out of office entry to send that user appropriate email.
|
||||
const previousOutOfOfficeEntry = await prisma.outOfOfficeEntry.findUnique({
|
||||
@@ -181,8 +181,8 @@ export const outOfOfficeCreateOrUpdate = async ({ ctx, input }: TBookingRedirect
|
||||
},
|
||||
create: {
|
||||
uuid: uuidv4(),
|
||||
start: startDateUtc.startOf("day").toISOString(),
|
||||
end: endDateUtc.endOf("day").toISOString(),
|
||||
start: startTimeUtc,
|
||||
end: endTimeUtc,
|
||||
notes: input.notes,
|
||||
userId: ctx.user.id,
|
||||
reasonId: input.reasonId,
|
||||
@@ -191,8 +191,8 @@ export const outOfOfficeCreateOrUpdate = async ({ ctx, input }: TBookingRedirect
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
update: {
|
||||
start: startDateUtc.startOf("day").toISOString(),
|
||||
end: endDateUtc.endOf("day").toISOString(),
|
||||
start: startTimeUtc,
|
||||
end: endTimeUtc,
|
||||
notes: input.notes,
|
||||
userId: ctx.user.id,
|
||||
reasonId: input.reasonId,
|
||||
|
||||
Reference in new issue
Block a user