fix: Cannot read properties of undefined (reading 'timeZone') (#18107)

Co-authored-by: Hariom <hariombalhara@gmail.com>
This commit is contained in:
PraashandHariom authored and GitHub committed 2025-01-07 04:17:17 +00:00
1 parent 6f531d0be5
commit 6178092878
1 file changed
+6 -2
+6 -2
View File
@@ -24,14 +24,18 @@ export const getWhen = (
calEvent: Pick<CalendarEvent, "organizer" | "attendees" | "seatsPerTimeSlot">,
t: TFunction
) => {
const organizerTimezone = calEvent.organizer?.timeZone ?? "UTC";
const defaultTimezone = organizerTimezone;
const attendeeTimezone = calEvent.attendees?.[0]?.timeZone ?? defaultTimezone;
return calEvent.seatsPerTimeSlot
? `
${t("organizer_timezone")}:
${calEvent.organizer.timeZone}
${organizerTimezone}
`
: `
${t("invitee_timezone")}:
${calEvent.attendees[0].timeZone}
${attendeeTimezone}
`;
};