Skip to content
Dethink Components

ComponentsDateTimePicker

DateTimePicker

Let users choose a date and time.

On this page

Use this component from the local workspace package. Follow the setup guide first. A public npm package and registry are not available yet.

View registry files

Import the component into your page or component file.

Usage
import {
  DateTimePicker,
  type DateTimePickerValue,
} from "@dethink/components";
import { CalendarDateTime, parseZonedDateTime } from "@internationalized/date";

Try the examples, then open the code to use them in your app. Tab through the segments or open the popover for the calendar, presets, and time selector.

Basic

Open the calendar to choose a date and time together, or use the clock button to jump straight to time.

Kickoff meeting
Choose a date, set a time, then select Done.
Show sourceexamples/date-time-picker/basic.tsx
examples/date-time-picker/basic.tsx
"use client";

import { DateTimePicker } from "@dethink/components";
import { CalendarDateTime } from "@internationalized/date";

export function DateTimePickerBasic() {
  return (
    <div className="mx-auto max-w-sm">
      <DateTimePicker
        label="Kickoff meeting"
        description="Choose a date, set a time, then select Done."
        name="kickoffAt"
        defaultValue={new CalendarDateTime(2026, 7, 14, 9, 30)}
      />
    </div>
  );
}

Granularity and hour cycle

granularity trims or extends the time segments, and hourCycle forces 12- or 24-hour display regardless of locale.

Hour precision
12-hour time
Second precision, 24h
Show sourceexamples/date-time-picker/granularity.tsx
examples/date-time-picker/granularity.tsx
"use client";

import { DateTimePicker } from "@dethink/components";
import { CalendarDateTime } from "@internationalized/date";

export function DateTimePickerGranularity() {
  return (
    <div className="mx-auto grid max-w-2xl gap-5 lg:grid-cols-2">
      <DateTimePicker
        label="Hour precision"
        granularity="hour"
        defaultValue={new CalendarDateTime(2026, 7, 14, 9)}
      />
      <DateTimePicker
        label="12-hour time"
        hourCycle={12}
        defaultValue={new CalendarDateTime(2026, 7, 14, 14, 30)}
      />
      <DateTimePicker
        label="Second precision, 24h"
        granularity="second"
        hourCycle={24}
        defaultValue={new CalendarDateTime(2026, 7, 14, 21, 30, 15)}
      />
    </div>
  );
}

Zoned value

A ZonedDateTime value carries its IANA zone — the field shows the zone and the serialized value keeps the offset.

Webinar (New York)
America/New_York

Value: 2026-07-14T09:30:00-04:00[America/New_York]

Show sourceexamples/date-time-picker/zoned.tsx
examples/date-time-picker/zoned.tsx
"use client";

import { useState } from "react";
import { DateTimePicker, type DateTimePickerValue } from "@dethink/components";
import { parseZonedDateTime } from "@internationalized/date";

export function DateTimePickerZoned() {
  const [value, setValue] = useState<DateTimePickerValue | null>(
    parseZonedDateTime("2026-07-14T09:30[America/New_York]"),
  );

  return (
    <div className="mx-auto max-w-sm space-y-3">
      <DateTimePicker
        label="Webinar (New York)"
        value={value}
        onValueChange={setValue}
        clearable
      />
      <p className="text-muted-foreground text-sm">
        Value: {value ? value.toString() : "none"}
      </p>
    </div>
  );
}

Presets

presets add one-click timestamps to the popover for common choices.

Publish at
Show sourceexamples/date-time-picker/presets.tsx
examples/date-time-picker/presets.tsx
"use client";

import { DateTimePicker } from "@dethink/components";
import { CalendarDateTime } from "@internationalized/date";

export function DateTimePickerPresets() {
  return (
    <div className="mx-auto max-w-sm">
      <DateTimePicker
        label="Publish at"
        presets={[
          {
            label: "Launch day 9:00",
            value: new CalendarDateTime(2026, 7, 14, 9, 0),
          },
          {
            label: "Launch day 17:00",
            value: new CalendarDateTime(2026, 7, 14, 17, 0),
          },
          {
            label: "Friday wrap-up",
            value: new CalendarDateTime(2026, 7, 17, 16, 0),
          },
        ]}
      />
    </div>
  );
}

Time selector

Quick picks every 15 minutes, with unavailable times disabled. Type any exact time using the hour and minute segments.

Interview slot
Pick times from a 15-minute grid instead of typing them.
Show sourceexamples/date-time-picker/time-selector.tsx
examples/date-time-picker/time-selector.tsx
"use client";

import { DateTimePicker } from "@dethink/components";
import { CalendarDateTime } from "@internationalized/date";

export function DateTimePickerTimeSelector() {
  return (
    <div className="mx-auto max-w-sm">
      <DateTimePicker
        label="Interview slot"
        description="Pick times from a 15-minute grid instead of typing them."
        timeSelector
        timeStep={15}
        minValue={new CalendarDateTime(2026, 7, 14, 8, 0)}
        maxValue={new CalendarDateTime(2026, 7, 14, 18, 0)}
        defaultValue={new CalendarDateTime(2026, 7, 14, 10, 15)}
      />
    </div>
  );
}

DateTimePicker owns its field anatomy — pass a label instead of wrapping it in an external one.

DateTimePicker props
PropWhat it doesDefault
valueDateTimePickerValue | nullControlled value — a CalendarDateTime or ZonedDateTime from @internationalized/date.Not set
defaultValueDateTimePickerValue | nullInitial value for uncontrolled usage.Not set
onValueChange(value: DateTimePickerValue | null) => voidFires when the value changes or is cleared.Not set
granularity"hour" | "minute" | "second"Smallest time segment shown in the field."minute"
hourCycle12 | 24Forces 12-hour or 24-hour time display.locale default
timeZonestringIANA zone used for display; ZonedDateTime values carry their own zone.Not set
hideTimeZonebooleanHides the time-zone segment for zoned values.false
presetsDateTimePickerPreset[]Quick-pick options ({ label, value }) rendered inside the popover.[]
timeSelectorbooleanShows editable time and quick picks alongside the calendar. Set false for a calendar-only popover.true
timeStep5 | 10 | 15 | 30 | 60Minute interval used to generate time-selector options.30
timeOptionsDateTimePickerTimeOption[]Explicit time options ({ hour, minute, second, label }) overriding the generated grid.Not set
label / description / errorMessageReactNodeThe field label, help text, and error message.Not set
namestringName of the hidden input submitted with the serialized ISO value.Not set
required / disabled / readOnly / invalidbooleanMakes the field required, disabled, read-only, or invalid.false
clearablebooleanShows a clear button when a value is set.false
minValue / maxValueDateValueInclusive bounds validate typed values and disable unavailable calendar dates and quick picks.Not set
isDateUnavailable(date: DateValue) => booleanMarks individual dates unavailable in the popover calendar.Not set
locale / weekStartsOnstring / weekdayFormatting locale and first day of the week in the popover calendar.runtime locale