import { shallow } from "zustand/shallow"; import type { Dayjs } from "@calcom/dayjs"; import dayjs from "@calcom/dayjs"; import { classNames } from "@calcom/lib"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { nameOfDay } from "@calcom/lib/weekday"; import { BookerLayouts } from "@calcom/prisma/zod-utils"; import { useBookerStore } from "../Booker/store"; import { TimeFormatToggle } from "./TimeFormatToggle"; type AvailableTimesHeaderProps = { date: Dayjs; showTimeFormatToggle?: boolean; availableMonth?: string | undefined; }; export const AvailableTimesHeader = ({ date, showTimeFormatToggle = true, availableMonth, }: AvailableTimesHeaderProps) => { const { t, i18n } = useLocale(); const [layout] = useBookerStore((state) => [state.layout], shallow); const isColumnView = layout === BookerLayouts.COLUMN_VIEW; const isMonthView = layout === BookerLayouts.MONTH_VIEW; const isToday = dayjs().isSame(date, "day"); return (
{nameOfDay(i18n.language, Number(date.format("d")), "short")} {date.format("DD")} {availableMonth && `, ${availableMonth}`} {showTimeFormatToggle && (
)}
); };