From 09c4040ce5da86e97dd6de08246f69876214e02c Mon Sep 17 00:00:00 2001 From: Muhammad Redho Ayassa Date: Sat, 8 Jan 2022 23:54:02 +0700 Subject: [PATCH] fix missing date in book page (#1430) --- components/booking/pages/BookingPage.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/components/booking/pages/BookingPage.tsx b/components/booking/pages/BookingPage.tsx index 1bd379729b..cb4ece5786 100644 --- a/components/booking/pages/BookingPage.tsx +++ b/components/booking/pages/BookingPage.tsx @@ -183,6 +183,14 @@ const BookingPage = (props: BookingPageProps) => { } }; + const parseDate = (date: string | null) => { + if (!date) return "No date"; + const parsedZone = parseZone(date); + if (!parsedZone?.isValid()) return "Invalid date"; + const formattedTime = parsedZone?.format(timeFormat); + return formattedTime + ", " + dayjs(date).toDate().toLocaleString(i18n.language, { dateStyle: "full" }); + }; + const bookEvent = (booking: BookingFormValues) => { telemetry.withJitsu((jitsu) => jitsu.track(telemetryEventTypes.bookingConfirmed, collectPageParameters()) @@ -284,10 +292,7 @@ const BookingPage = (props: BookingPageProps) => { )}

- {(date && parseZone(date)?.format(timeFormat)) || - "No date" + - ", " + - dayjs(date).toDate().toLocaleString(i18n.language, { dateStyle: "full" })} + {parseDate(date)}

{props.eventType.description}