Skip to content
Protocore Design Systemv1.6.9

/// Inputs

DateTimePicker

Sunken field that opens a Calendar above a TimeInput in one overlay, so a date and a time are chosen together and returned as a single Date.

import { DateTimePicker } from "@protocore/pds";
View as Markdown

Basics

The trigger shows a formatted date-and-time; opening it reveals a Calendar above a TimeInput. Choosing a day keeps the current time, changing the time keeps the day. Controllable via value / defaultValue / onValueChange with a single Date.

Bounded, 12-hour & clearable

Wrap it in a Field for a label and hint. Constrain the calendar with min / max, switch the time to hour12, add withSeconds for precision, and set clearable to expose a reset once a value is chosen.

Within the next 60 days.

When to use it

Use DateTimePicker when a single instant matters — a scheduled deploy, an event start. It composes Calendar and TimeInput so the two parts stay in sync as one Date. When only the date matters use DatePicker; when only the time matters use TimePicker.

Usage

Do

  • Give the trigger an accessible name via a `Field` label or `aria-label`.
  • Set `min` / `max` to the valid window so out-of-range days can't be picked.
  • Match `hour12` and `locale` to the surrounding UI's conventions.
  • Read the combined `Date` from `onValueChange` — it carries both parts.

Don't

  • Don't pair a separate DatePicker and TimePicker when the two must move as one instant.
  • Don't leave the trigger unlabelled when no visible field label wraps it.
  • Don't reconstruct the value from the field string — use the `Date`.
  • Don't nest it inside another popover trigger where overlays contend for focus.

Accessibility

KeysAction
Enter / SpaceOpen the overlay from the focused trigger.
Arrow keysMove between days in the calendar grid.
TabMove from the calendar into the time segments.
EscClose the overlay without changing the value.
  • The overlay is a Radix Popover: portalled, dismissed on outside-click and Escape, and returns focus to the trigger on close.
  • The calendar is a `role="grid"`; the time field is a `role="group"` of spinbutton segments.
  • `invalid` sets `aria-invalid` on the trigger; the trigger exposes `aria-expanded` for its open state.

DateTimePicker props

PropTypeDefaultDescription
classNamestring
clearablebooleanfalseShow a clear button when a value is selected.
defaultOpenbooleanInitial open state in uncontrolled mode.
defaultValueDate | nullInitial date-time in uncontrolled mode.
disabledbooleanDisable the whole control.
formatDateTimeFormatOptions | ((date: Date) => string)How the value renders in the field. `Intl.DateTimeFormatOptions` or a function.
hour12booleanfalseUse a 12-hour clock for the time field.
invalidbooleanMark the field invalid — danger border plus `aria-invalid`.
isDateDisabled((date: Date) => boolean)Predicate to disable arbitrary days.
localestringBCP-47 locale for the field label and calendar.
maxDateLatest selectable day (inclusive).
minDateEarliest selectable day (inclusive).
onOpenChange((open: boolean) => void)Fires when the overlay opens or closes.
onValueChange((value: Date | null) => void)Fires with the chosen `Date` (or `null` when cleared).
openbooleanControlled open state of the overlay.
placeholderstringSelect date & timeText shown when no value is selected.
sizeenummdField height: `sm` (32) · `md` (36, default) · `lg` (40).
styleCSSProperties
valueDate | nullControlled selected date-time. Pass `null` for no selection.
weekStartsOnenum1First column of the week: 0 = Sunday … 6 = Saturday.
withSecondsbooleanfalseInclude a seconds segment in the time field.

Related

  • DatePickerSunken field showing a formatted date that opens a Calendar in a raised overlay for point-and-click selection.
  • TimeInputSegmented HH:MM(:SS) field where each part is an ARIA spinbutton — arrow keys step it and typed digits auto-advance.
  • TimePickerSunken field that opens a TimeInput plus scrollable hour / minute columns in a raised overlay for point-and-click time selection.
  • CalendarMonth-grid date picker with full keyboard navigation, single or range selection, and locale-aware labels.