Skip to content

Getting Started

temporal-react-datepicker is a React date picker built on the Temporal API. Pick a date, get back an immutable Temporal.PlainDate — no Date objects, no timezone surprises.

The library exports two components:

ComponentUse when…
TemporalDatePickerYou need a standalone calendar (embedded in a page, sidebar, or popover you control).
DatePickerInputYou need a form field — a segmented input that opens a calendar popover.
RequiresReact 19+@js-temporal/polyfill
$ npm install temporal-react-datepicker @js-temporal/polyfill
tsx
import { useState } from 'react'
import { Temporal } from '@js-temporal/polyfill'
import { TemporalDatePicker } from 'temporal-react-datepicker'

type DateValue = Temporal.PlainDate | undefined

function App() {
  const [date, setDate] = useState<DateValue>()

  return <TemporalDatePicker value={date} onChange={setDate} />
}

The value prop accepts a Temporal.PlainDate (or undefined when nothing is selected). onChange fires with the newly selected date each time the user picks a day.

Pass clearable to show a × button that resets the selection. When cleared, onChange receives undefined.

tsx
<TemporalDatePicker
  clearable
  value={date}
  onChange={setDate}
/>

For a form-field experience — a locale-aware segmented input that opens a popover calendar:

tsx
import { useState } from 'react'
import { Temporal } from '@js-temporal/polyfill'
import { DatePickerInput } from 'temporal-react-datepicker'

function App() {
  const [date, setDate] = useState<Temporal.PlainDate | undefined>(undefined)

  return <DatePickerInput clearable value={date} onChange={setDate} />
}

The segment order adapts to the user’s locale automatically (es-ESdd/mm/aaaa, en-USmm/dd/yyyy). See the DatePickerInput guide for all options.