From 240474d14cf7c64140a581b55289c3914861c33c Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Mon, 20 Jan 2025 13:11:18 +0530 Subject: [PATCH] remove hack for tz conversion; --- src/pages/PublicAppointments/Success.tsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/pages/PublicAppointments/Success.tsx b/src/pages/PublicAppointments/Success.tsx index 3a4c40f6dac..bce4d2798d5 100644 --- a/src/pages/PublicAppointments/Success.tsx +++ b/src/pages/PublicAppointments/Success.tsx @@ -1,6 +1,5 @@ import { useQuery } from "@tanstack/react-query"; import { format } from "date-fns"; -import dayjs from "dayjs"; import { useTranslation } from "react-i18next"; import { toast } from "sonner"; @@ -42,16 +41,13 @@ export function AppointmentSuccess(props: { appointmentId: string }) { (appointment) => appointment.id === appointmentId, ); - if (isLoading) { + if (isLoading || !appointmentData) { return ; } - const appointmentTime = dayjs(appointmentData?.token_slot.start_datetime) - .add(-5, "hours") - .add(-30, "minutes") - .toISOString(); - const appointmentDate = format(new Date(appointmentTime), "do MMMM"); - const appointmentTimeSlot = format(new Date(appointmentTime), "hh:mm a"); + const appointmentTime = appointmentData.token_slot.start_datetime; + const appointmentDate = format(appointmentTime, "do MMMM"); + const appointmentTimeSlot = format(appointmentTime, "hh:mm a"); return (