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. withTime adds , HH:MM to the field (24.11.2026, 14:30) and a time list beside the calendar every timeStep minutes (30 by default, 5 at least). A typed time off that grid is listed too. Picking a day keeps the popover open with defaultTime (08:00) until a time is picked; picking a time closes it and returns focus to the field. onDateChange gets 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 rejectedKeyMessage and it is read out politely each time.
  • Opening. The chosen day takes focus when the popover opens, and getDefaultDate sets 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:

PropTypeDefaultDescription
withTimebooleanfalseAdds , HH:MM to the field and a time list beside the calendar.
timeStepnumber30Minutes between the times the list offers; 5 at least.
timeLabelstring—Accessible name of the time list.
defaultTimestring"08:00"Time a day picked from the calendar gets while no time is set.
getDefaultDate() => DatetodayDay a time picked before any date applies to, and the month an empty field opens on.
rejectedKeyMessagestring—Read out politely when a key the mask ignores is typed.

Accessibility

Key / pointerAction
Click the valuePlaces a caret. With pickerOnly, opens the popover.
Calendar button, Down ArrowOpens the popover; the chosen day takes focus.
Backspace after a separatorDeletes the digit before the separator.
Up / Down Arrow, Home, End in the time listMove between times; Enter or Space picks one.
EscapeCloses 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.

On this page