Use the DateTimePicker component
mainThe DateTimePicker is an all-in-one calendar and time picker in a single popover. It is ideal for forms and scheduling.
Basic Usage
import { DateTimePicker } from "@/components/datetime-picker";
export default function MyForm() {
const [date, setDate] = useState<Date>();
return <DateTimePicker value={date} onChange={setDate} />;
}Common Configurations
- 12-Hour Format:
<DateTimePicker hourFormat={12} /> - Business Hours: Restrict time using
minTimeandmaxTime(e.g.,minTime="09:00",maxTime="17:00") and settimeInterval(15, 30, or 60). - Timezone Selector: Use
showTimezoneto enable the dropdown. You can pre-set a timezone withtimezone="America/New_York"or track changes withonTimezoneChange. - Date Restrictions: Use
minDateandmaxDateto constrain selectable dates. UsedisabledDateswith a callback function to disable specific days (e.g., weekends). - Week Start: Set
weekStartsOn={1}to start the week on Monday (0 is Sunday).