Skip to content

DateTimePicker

A day and an hour in one control: a moment. The day can be picked from a calendar; the hour is typed.

import { DateTimePicker } from '@sypnia/ui/react'

On this page
  1. A moment
  2. States
  3. When to use it
  4. For everyone
  5. Props

A moment

Type the hour, pick the day. The hint shows it the way a person would say it.

Nov 21, 2026, 2:30 AM, in the time zone of the project. Saved as 2026-11-21T02:30.

Code
import { useState } from 'react';
import { DateTimePicker, Field, FormGrid, useSypnia } from '@sypnia/ui/react';

export default function Basic() {
  const { format } = useSypnia();
  const [at, setAt] = useState<string | null>('2026-11-21T02:30');
  return (
    <FormGrid>
      <Field label="Start the maintenance at" hint={at ? <>{format.dateTime(at)}, in the time zone of the project. Saved as <code>{at}</code>.</> : 'Choose a quiet moment.'}>
        <DateTimePicker value={at} onChange={setAt} min="2026-11-17" />
      </Field>
    </FormGrid>
  );
}

States

With an error that says how to fix it, and disabled.

That moment has passed. Choose one after now.

Made by the nightly job.

Code
import { DateTimePicker, Field, FormGrid } from '@sypnia/ui/react';

export default function States() {
  return (
    <FormGrid>
      <Field label="Run the export at" error="That moment has passed. Choose one after now.">
        <DateTimePicker defaultValue="2026-11-10T09:00" />
      </Field>
      <Field label="Last backup" hint="Made by the nightly job.">
        <DateTimePicker disabled defaultValue="2026-11-17T03:00" />
      </Field>
    </FormGrid>
  );
}

When to use it

Use it when

  • Something happens once, at an exact moment: a maintenance, a scheduled export, the end of an offer.
  • Day and hour only make sense together.

Do not use it when

  • Only the day matters: DatePicker.
  • It repeats every day at the same hour: TimePicker.
  • It is a period: DateRangePicker.

For everyone

  • Each part (day, month, year, hour, minute) is a spinbutton: typing fills it and jumps to the next; arrows change it and move between parts.
  • The button opens the calendar; choosing a day keeps the hour that was typed.
  • The value is ISO text without a time zone (2026-11-17T14:30): say beside it which zone it means.
  • Inside a Field it takes the label, the hint and the error by itself; alone, give it an aria-label.

Props

DateTimePickerTypeDefault
aria-describedby string
aria-label

The name for screen readers when there is no Field around it.

string
aria-labelledby string
className string
defaultValue string
disabled boolean
hourCycle

12 or 24 hours. By default, what the language uses.

12 | 24
id

Inside a Field it comes from the Field.

string
invalid

Marks the value as wrong. Inside a `<Field error>` it is set for you.

boolean
max

The last day that can be chosen.

string
min

The first day that can be chosen, as `2026-11-01`.

string
name

The name of the value when it travels in a form.

string
onChange ((dateTime: string | null) => void)
unavailable

Days that cannot be chosen: return true for them.

((date: string) => boolean)
value

The moment, as `2026-11-17T14:30`, or null while it is empty.

string | null
  1. A moment
  2. States
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms