|
1
|
"use client" |
|
2
|
|
|
3
|
import { DatePicker } from "@medusajs/ui" |
|
4
|
|
|
5
|
export default function DatePickerGranularity() { |
|
6
|
const defaultDate = new Date() |
|
7
|
|
|
8
|
return ( |
|
9
|
<div className="space-y-6 max-w-md"> |
|
10
|
<div className="space-y-2"> |
|
11
|
<div className="text-ui-fg-base text-ui-body-small font-medium">Date Only</div> |
|
12
|
<DatePicker |
|
13
|
granularity="day" |
|
14
|
defaultValue={defaultDate} |
|
15
|
aria-label="Select day only" |
|
16
|
/> |
|
17
|
</div> |
|
18
|
|
|
19
|
<div className="space-y-2"> |
|
20
|
<div className="text-ui-fg-base text-ui-body-small font-medium">Date and Time with Hour Precision</div> |
|
21
|
<DatePicker |
|
22
|
granularity="hour" |
|
23
|
defaultValue={defaultDate} |
|
24
|
aria-label="Select date and hour" |
|
25
|
/> |
|
26
|
</div> |
|
27
|
|
|
28
|
<div className="space-y-2"> |
|
29
|
<div className="text-ui-fg-base text-ui-body-small font-medium">Date and Time with Minute Precision</div> |
|
30
|
<DatePicker |
|
31
|
granularity="minute" |
|
32
|
defaultValue={defaultDate} |
|
33
|
aria-label="Select date and time with minutes" |
|
34
|
/> |
|
35
|
</div> |
|
36
|
|
|
37
|
<div className="space-y-2"> |
|
38
|
<div className="text-ui-fg-base text-ui-body-small font-medium">Date and Time with Second Precision</div> |
|
39
|
<DatePicker |
|
40
|
granularity="second" |
|
41
|
defaultValue={defaultDate} |
|
42
|
aria-label="Select date and time with seconds" |
|
43
|
/> |
|
44
|
</div> |
|
45
|
</div> |
|
46
|
) |
|
47
|
} |