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:
Eunjae Lee authored and GitHub committed 2024-11-19 19:54:12 -03:00
1 parent 757e3a2faf
commit 997d6a75e8
3 files changed
+12 -11

No files matched your search

@@ -104,8 +104,8 @@ export const CreateOrEditOutOfOfficeEntryModal = ({
? currentlyEditingOutOfOfficeEntry
: {
dateRange: {
startDate: dayjs().utc().startOf("d").toDate(),
endDate: dayjs().utc().add(1, "d").endOf("d").toDate(),
startDate: dayjs().startOf("d").toDate(),
endDate: dayjs().startOf("d").add(2, "d").toDate(),
},
offset: dayjs().utcOffset(),
toTeamUserId: null,
@@ -126,13 +126,14 @@ export const OutOfOfficeEntriesList = () => {
data-testid={`ooo-edit-${item.toUser?.username || "n-a"}`}
StartIcon="pencil"
onClick={() => {
const offset = dayjs().utcOffset();
const outOfOfficeEntryData: BookingRedirectForm = {
uuid: item.uuid,
dateRange: {
startDate: item.start,
endDate: dayjs(item.end).subtract(1, "d").toDate(),
startDate: dayjs(item.start).subtract(offset, "minute").toDate(),
endDate: dayjs(item.end).subtract(offset, "minute").startOf("d").toDate(),
},
offset: dayjs().utcOffset(),
offset,
toTeamUserId: item.toUserId,
reasonId: item.reason?.id ?? 1,
notes: item.notes ?? undefined,