|
1
|
"use client" |
|
2
|
|
|
3
|
import { DatePicker } from "@medusajs/ui" |
|
4
|
|
|
5
|
export default function DatePickerBusinessHours() { |
|
6
|
return ( |
|
7
|
<div className="w-[300px]"> |
|
8
|
<DatePicker |
|
9
|
granularity="hour" |
|
10
|
defaultValue={new Date()} |
|
11
|
aria-label="Select date and hour for business scheduling" |
|
12
|
isDateUnavailable={(date) => { |
|
13
|
// Disable weekends and holidays |
|
14
|
const day = date.getDay() |
|
15
|
const isWeekend = day === 0 || day === 6 |
|
16
|
|
|
17
|
// Example: Disable specific holiday (Christmas) |
|
18
|
const isChristmas = date.getMonth() === 11 && date.getDate() === 25 |
|
19
|
|
|
20
|
return isWeekend || isChristmas |
|
21
|
}} |
|
22
|
/> |
|
23
|
</div> |
|
24
|
) |
|
25
|
} |