Skip to main content

DatePicker

iOS Android
DatePicker on iOS DatePicker on Android

Native date & time picker using platform system pickers.

Props

PropTypeDescription
dateDate | nullControlled date value
minDateDate | nullMinimum selectable date
maxDateDate | nullMaximum selectable date
localestringLocale identifier (e.g., 'en-US')
timeZoneNamestringTime zone identifier
mode'date' | 'time' | 'dateAndTime' | 'countDownTimer'Picker mode
presentation'modal' | 'embedded'Presentation style
visiblebooleanControls modal visibility (modal mode only)
onConfirm(date: Date, confirmed: boolean) => voidCalled on date change; confirmed is true for deliberate selections (see below)
onClosed() => voidCalled when modal is dismissed

iOS Props (ios)

PropTypeDescription
preferredStyle'automatic' | 'compact' | 'inline' | 'wheels'iOS date picker style
countDownDurationSecondsnumberDuration for countdown timer mode
minuteIntervalnumberMinute interval (1-30)
roundsToMinuteInterval'inherit' | 'round' | 'noRound'Rounding behavior
showConfirmToolbarbooleanModal only. Show Cancel/Done toolbar below the picker. Defaults to true. See below.

Android Props (android)

PropTypeDescription
firstDayOfWeeknumberFirst day of week (1-7, Sunday=1)
material'system' | 'm3'Material Design style (modal only; embedded always uses system picker)
dialogTitlestringCustom dialog title
positiveButtonTitlestringCustom confirm button text
negativeButtonTitlestringCustom cancel button text

The confirmed Flag

onConfirm fires on every date/time change, but the second argument (confirmed) lets you distinguish between browsing and deliberate selections:

Platform / ModeEvery changeDeliberate selection
iOS modalconfirmed: false (user still adjusting)confirmed: true (tapping Done)
iOS embeddedconfirmed: true
Android modalconfirmed: true (pressing OK)
Android embeddedconfirmed: true

On iOS in modal presentation, the picker is shown in a popover with a Cancel/Done toolbar below it. Tapping Done emits confirmed: true; tapping Cancel or outside the popover calls onClosed. Set ios.showConfirmToolbar: false to hide the toolbar — in that mode confirmed: true never fires, and your app is expected to drive dismissal by flipping visible off (reading the current date from the stream of confirmed: false events). This only makes UX sense paired with ios.preferredStyle: 'inline'.

A common pattern is to close the modal only on a confirmed selection:

<DatePicker
date={date}
visible={visible}
presentation="modal"
mode="time"
onConfirm={(d, confirmed) => {
setDate(d);
if (confirmed) setVisible(false);
}}
onClosed={() => setVisible(false)}
/>