project/medusa-foundation-audit
| 1 | "use client" |
| 2 | |
| 3 | import { DatePicker } from "@medusajs/ui" |
| 4 | |
| 5 | export default function DatePickerDisabledDates() { |
| 6 | // Disable weekends (Saturday and Sunday) |
| 7 | const isWeekend = (date: Date) => { |
| 8 | const day = date.getDay() |
| 9 | return day === 0 || day === 6 // Sunday = 0, Saturday = 6 |
| 10 | } |
| 11 | |
| 12 | return ( |
| 13 | <div className="w-[300px]"> |
| 14 | <DatePicker |
| 15 | isDateUnavailable={isWeekend} |
| 16 | aria-label="Select a weekday (weekends disabled)" |
| 17 | /> |
| 18 | </div> |
| 19 | ) |
| 20 | } |