1- import dynamic from "next/dynamic" ;
2- import { useMemo } from "react" ;
3- import { shallow } from "zustand/shallow" ;
4-
51import { Timezone as PlatformTimezoneSelect } from "@calcom/atoms/timezone" ;
2+ import dayjs from "@calcom/dayjs" ;
63import { useBookerStoreContext } from "@calcom/features/bookings/Booker/BookerStoreProvider" ;
74import type { Timezone } from "@calcom/features/bookings/Booker/types" ;
5+ import { useTimePreferences } from "@calcom/features/bookings/lib" ;
86import type { BookerEvent } from "@calcom/features/bookings/types" ;
97import { EventDetailBlocks } from "@calcom/features/bookings/types" ;
10- import { useTimePreferences } from "@calcom/features/bookings/lib" ;
8+ import type { TimezoneSelectComponentProps } from "@calcom/features/timezone/components/TimezoneSelectComponent" ;
9+ import { useLocale } from "@calcom/lib/hooks/useLocale" ;
1110import { CURRENT_TIMEZONE } from "@calcom/lib/timezoneConstants" ;
1211import { Button } from "@calcom/ui/components/button" ;
1312import { Icon } from "@calcom/ui/components/icon" ;
14-
13+ import dynamic from "next/dynamic" ;
14+ import type { ComponentType } from "react" ;
15+ import { useMemo } from "react" ;
16+ import { shallow } from "zustand/shallow" ;
1517import { EventDetails } from "./event-meta/Details" ;
16- import { useLocale } from "@calcom/lib/hooks/useLocale" ;
1718
18- const LoadingState = ( ) => {
19+ const LoadingState = ( ) : JSX . Element => {
1920 const { t } = useLocale ( ) ;
2021 return < span className = "text-default text-sm" > { t ( "loading" ) } </ span > ;
2122} ;
2223
23- const WebTimezoneSelect = dynamic (
24+ type TimezoneSelectProps = Omit <
25+ TimezoneSelectComponentProps ,
26+ "data" | "isPending" | "isWebTimezoneSelect"
27+ > & {
28+ timeZones ?: Timezone [ ] ;
29+ } ;
30+
31+ const WebTimezoneSelect : ComponentType < TimezoneSelectProps > = dynamic (
2432 ( ) =>
2533 import ( "@calcom/web/modules/timezone/components/TimezoneSelect" ) . then (
2634 ( mod ) => mod . TimezoneSelect
@@ -58,7 +66,7 @@ export const SlotSelectionModalHeader = ({
5866 isPlatform = false ,
5967 timeZones,
6068 selectedDate,
61- } : SlotSelectionModalHeaderProps ) => {
69+ } : SlotSelectionModalHeaderProps ) : JSX . Element => {
6270 const { i18n } = useLocale ( ) ;
6371 const [ setTimezone ] = useTimePreferences ( ( state ) => [ state . setTimezone ] ) ;
6472 const [ timezone , setBookerStoreTimezone ] = useBookerStoreContext (
@@ -72,23 +80,19 @@ export const SlotSelectionModalHeader = ({
7280
7381 const formattedDate = useMemo ( ( ) => {
7482 if ( ! selectedDate ) return { dayOfWeek : "" , fullDate : "" } ;
75- const date = new Date ( selectedDate ) ;
76- const dayOfWeek = date . toLocaleDateString ( i18n . language , {
77- weekday : "long" ,
78- } ) ;
79- const fullDate = date . toLocaleDateString ( i18n . language , {
80- month : "long" ,
81- day : "numeric" ,
82- year : "numeric" ,
83- } ) ;
83+
84+ const date = dayjs ( selectedDate ) ;
85+ const dayOfWeek = date . locale ( i18n . language ) . format ( "dddd" ) ;
86+ const fullDate = date . locale ( i18n . language ) . format ( "MMMM D, YYYY" ) ;
87+
8488 return { dayOfWeek, fullDate } ;
8589 } , [ selectedDate , i18n . language ] ) ;
8690
8791 return (
88- < div className = "two-step-slot-selection-modal-header bg-default border-subtle sticky top-0 z-10 flex flex-col mb-4 mt-0 border-b pb-4 -mx-4 px-8" >
92+ < div className = "two-step-slot-selection-modal-header sticky top-0 z-10 -mx-4 mt-0 mb-4 flex flex-col border-subtle border-b bg-default px-8 pb-4 " >
8993 < div className = "flex flex-col gap-2 pt-8" >
9094 < div className = "flex flex-col" >
91- < span className = "text-emphasis text-lg font-semibold " >
95+ < span className = "font-semibold text-emphasis text-lg" >
9296 < Button
9397 color = "minimal"
9498 StartIcon = "arrow-left"
@@ -104,10 +108,10 @@ export const SlotSelectionModalHeader = ({
104108 < EventDetails event = { event } blocks = { [ EventDetailBlocks . DURATION ] } />
105109 ) }
106110
107- < div className = "text-default flex items-center gap-2 text-sm mb-0 " >
108- < Icon name = "globe" className = "text-subtle h-4 w-4 shrink-0" />
111+ < div className = "mb-0 flex items-center gap-2 text-default text-sm " >
112+ < Icon name = "globe" className = "h-4 w-4 shrink-0 text-subtle " />
109113 { TimezoneSelect && (
110- < span className = "min-w-32 - mt-[2px] flex h-6 max-w-full items-center justify-start" >
114+ < span className = "- mt-[2px] flex h-6 min-w-32 max-w-full items-center justify-start" >
111115 < TimezoneSelect
112116 timeZones = { timeZones }
113117 menuPosition = "fixed"
0 commit comments