25 lines
578 B
TypeScript

'use client';
import { ScheduleContext } from '@/context/schedule';
import { Calendar } from '@repo/ui/components/ui/calendar';
import dayjs from 'dayjs';
import { use } from 'react';
export function ScheduleCalendar() {
const { selectedDate, setSelectedDate } = use(ScheduleContext);
return (
<Calendar
className="bg-background"
disabled={(date) => {
return dayjs().isAfter(dayjs(date), 'day');
}}
mode="single"
onSelect={(date) => {
if (date) setSelectedDate(date);
}}
selected={selectedDate}
/>
);
}