@@ -23,6 +23,7 @@ import {
2323 useIsBackgroundTransparent ,
2424 useIsEmbed ,
2525} from "@calcom/embed-core/embed-iframe" ;
26+ import { getServerSession } from "@calcom/features/auth/lib/getServerSession" ;
2627import {
2728 SystemField ,
2829 getBookingFieldsWithSystemFields ,
@@ -105,10 +106,10 @@ export default function Success(props: SuccessProps) {
105106 seatReferenceUid,
106107 } = querySchema . parse ( router . query ) ;
107108
108- const tz =
109- ( isSuccessBookingPage
110- ? props . bookingInfo . attendees . find ( ( attendee ) => attendee . email === email ) ?. timeZone
111- : props . bookingInfo . eventType ?. timeZone || props . bookingInfo . user ?. timeZone ) || timeZone ( ) ;
109+ const attendeeTimeZone = props ?. bookingInfo ?. attendees . find (
110+ ( attendee ) => attendee . email === email
111+ ) ?. timeZone ;
112+ const tz = isSuccessBookingPage && attendeeTimeZone ? attendeeTimeZone : props . tz ? props . tz : timeZone ( ) ;
112113
113114 const location = props . bookingInfo . location as ReturnType < typeof getEventLocationValue > ;
114115
@@ -917,7 +918,16 @@ const handleSeatsEventTypeOnBooking = (
917918
918919export async function getServerSideProps ( context : GetServerSidePropsContext ) {
919920 const ssr = await ssrInit ( context ) ;
921+ const session = await getServerSession ( context ) ;
922+ let tz : string | null = null ;
923+
924+ if ( session ) {
925+ const user = await ssr . viewer . me . fetch ( ) ;
926+ tz = user . timeZone ;
927+ }
928+
920929 const parsedQuery = querySchema . safeParse ( context . query ) ;
930+
921931 if ( ! parsedQuery . success ) return { notFound : true } ;
922932 const { uid, email, eventTypeSlug, cancel, isSuccessBookingPage } = parsedQuery . data ;
923933
@@ -1049,6 +1059,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
10491059 dynamicEventName : bookingInfo ?. eventType ?. eventName || "" ,
10501060 bookingInfo,
10511061 paymentStatus : payment ,
1062+ ...( tz && { tz } ) ,
10521063 } ,
10531064 } ;
10541065}
0 commit comments