From 6178092878b6abc9f2d2301591b6009d1e57dd90 Mon Sep 17 00:00:00 2001 From: Praash <99237795+Praashh@users.noreply.github.com> Date: Tue, 7 Jan 2025 09:47:17 +0530 Subject: [PATCH] fix: Cannot read properties of undefined (reading 'timeZone') (#18107) Co-authored-by: Hariom --- packages/lib/CalEventParser.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/lib/CalEventParser.ts b/packages/lib/CalEventParser.ts index 97c9335709..4872ddd0bc 100644 --- a/packages/lib/CalEventParser.ts +++ b/packages/lib/CalEventParser.ts @@ -24,14 +24,18 @@ export const getWhen = ( calEvent: Pick, 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} `; };