| 1 |
--- |
| 2 |
id: Date and time picker |
| 3 |
section: components |
| 4 |
subsection: date-and-time |
| 5 |
--- |
| 6 |
|
| 7 |
import { useState } from 'react'; |
| 8 |
import RhUiCalendarIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-calendar-icon'; |
| 9 |
import RhUiClockIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-clock-icon'; |
| 10 |
|
| 11 |
## Demos |
| 12 |
|
| 13 |
In this demo, learn how to use a [CalendarMonth](/components/date-and-time/calendar-month) component and a [Dropdown](/components/menus/dropdown) component to compose a simple DateTimePicker. The input is read only, meaning that the following example does not cover pasting a copied date and time. Also, you can pick the time only from the predefined options and cannot change it in the input. |
| 14 |
|
| 15 |
### Date and time picker |
| 16 |
|
| 17 |
```ts file="examples/DateTimePicker/DateTimePicker.tsx" |
| 18 |
|
| 19 |
``` |
| 20 |
|
| 21 |
### Date and time range picker |
| 22 |
|
| 23 |
```ts file="examples/DateTimePicker/DateTimeRangePicker.tsx" |
| 24 |
|
| 25 |
``` |