Input Date Time
A date, or a date and a time, in one typeable field with a calendar and a time list.
Usage
Input Date Time is Input Date's sibling for flows that need more from the field: an optional time in the same field, a time list beside the calendar, and keyboard and screen reader behaviour tuned for long forms. Input Date stays as it is; use Input Date Time where a time is needed or where these behaviours matter.
import { Field, FieldLabel } from '@epilot/spark-ui/field'
import { InputDateTime } from '@epilot/spark-ui/input-date-time'function AppointmentField() {
const [value, setValue] = useState('')
return (
<Field>
<FieldLabel>Appointment</FieldLabel>
<InputDateTime
calendarLabel={t('openCalendar')}
onValueChange={setValue}
rejectedKeyMessage={t('onlyNumbers')}
timeLabel={t('time')}
value={value}
withTime
/>
</Field>
)
}It shares Input Date's props and typing (ictus), and differs in these ways:
- Time.
withTimeadds, HH:MMto the field (24.11.2026, 14:30) and a time list beside the calendar everytimeStepminutes (30 by default, 5 at least). A typed time off that grid is listed too. Picking a day keeps the popover open withdefaultTime(08:00) until a time is picked; picking a time closes it and returns focus to the field.onDateChangegets the date with its time once both are complete. - Editing. Backspace right after a separator deletes the digit before it,
and Delete right before one the digit after. Pasted text (
24/11/2026 14:30) goes through the mask. - Ignored keys. Keys the mask ignores add nothing; pass a translated
rejectedKeyMessageand it is read out politely each time. - Opening. The chosen day takes focus when the popover opens, and
getDefaultDatesets the day an empty field opens on. - Anchoring. The popover anchors to a wrapper around the field, so it lines up with the field on React 18 too.
The value never holds placeholder characters, only what was typed plus the
separators reached, so one plain <input> reads out correctly.
dateTimeStatus, parseDateTime and formatDateTime read and write the
field's text, for example to tell an incomplete value from an invalid one.
Month and year lists
Pass calendarProps={{ captionLayout: 'lists' }} for month and year headers
that step on their own arrows and open a list in place of the days; the time
list steps aside while one is open. See
Calendar.
API Reference
InputDateTime
Everything Input Date takes, plus:
| Prop | Type | Default | Description |
|---|---|---|---|
withTime | boolean | false | Adds , HH:MM to the field and a time list beside the calendar. |
timeStep | number | 30 | Minutes between the times the list offers; 5 at least. |
timeLabel | string | — | Accessible name of the time list. |
defaultTime | string | "08:00" | Time a day picked from the calendar gets while no time is set. |
getDefaultDate | () => Date | today | Day a time picked before any date applies to, and the month an empty field opens on. |
rejectedKeyMessage | string | — | Read out politely when a key the mask ignores is typed. |
Accessibility
| Key / pointer | Action |
|---|---|
| Click the value | Places a caret. With pickerOnly, opens the popover. |
| Calendar button, Down Arrow | Opens the popover; the chosen day takes focus. |
| Backspace after a separator | Deletes the digit before the separator. |
| Up / Down Arrow, Home, End in the time list | Move between times; Enter or Space picks one. |
| Escape | Closes a month or year list, else the popover. |
Describe the expected format with aria-describedby (for example "Enter a
2-digit day, 2-digit month, and 4-digit year"), since the placeholder goes
away once typing starts.