🚀ReacUI is currently in Beta. We're actively improving it! ❣️
DateTimePicker
A flexible component for selecting dates, times, or both from a calendar or time input
April 2023
SuMoTuWeThFrSa
262728293031123456
Installation
The DateTimePicker component is part of the ReacUI library. Install the package to use it in your project.
Import
Import the DateTimePicker component into your React component.
Basic DatePicker
Use the DateTimePicker in date mode to allow users to select a date from a calendar.
TimePicker
Use the DateTimePicker in time mode to allow users to select a specific time.
DateTimePicker
Use the DateTimePicker in datetime mode to allow users to select both a date and time.
Date Range Picker
Use the DateTimePicker with the range prop to select a date range.
Customization
The DateTimePicker can be customized with various options.
API Reference
The following props are available for the DateTimePicker component.
| Prop | Type | Default | Description |
|---|---|---|---|
| value | Date | {start: Date, end: Date} | new Date() | The selected date/time value. |
| onChange | function | required | Callback function when the value changes. |
| mode | string | 'date' | Mode of the picker: 'date', 'time', or 'datetime'. |
| range | boolean | false | Whether to enable date range selection. |
| format | string | Depends on mode | Format string for the displayed date/time. |
| theme | string | 'secondary' | Color theme for the picker: 'primary', 'secondary', etc. |
| weekStartsOn | number | 0 | First day of the week (0 = Sunday, 1 = Monday, etc.). |
| minDate | Date | - | Minimum selectable date. |
| maxDate | Date | - | Maximum selectable date. |
| disabledDates | Date[] | [] | Array of dates that cannot be selected. |
| className | string | '' | Additional CSS classes for the component. |