Date and time picker
<date-time-picker> is the native date and time picker, typed for strict templates. It draws on
iOS and macOS: UIKit's UIDatePicker, and AppKit's date picker on the desktop host with no library
installed. On Android the library has no view, only a module that opens a dialog, so the element
commits as nothing there; open the library's DateTimePickerAndroid.open() from a press instead.
On iOS it needs @react-native-community/datetimepicker:
npx expo install @react-native-community/datetimepickerimport { Component, signal } from '@angular/core';
import { DateTimePicker } from '@ng-native/expo/date-time-picker';
@Component({
selector: 'app-due-date',
imports: [DateTimePicker],
template: `
<date-time-picker
mode="date"
displayIOS="compact"
[date]="due()"
(change)="due.set(asDate($event.nativeEvent.timestamp))"
/>
`,
})
export class DueDate {
protected readonly due = signal(new Date());
protected asDate(timestamp: number): Date {
return new Date(timestamp);
}
}The component is also exported from @ng-native/expo. It registers the element the first time one
is made, so no registerNativeViews call is needed.
Inputs and events
The inputs are the native view's, not the library's React component's: the moment is date, not
value, and the style is displayIOS.
date,minimumDate,maximumDate- aDateor milliseconds.mode-'date','time','datetime'or'countdown'.displayIOS-'default','spinner','compact'or'inline': wheels, a compact field that opens a popover, or a calendar.minuteInterval- the step between the minutes offered; one that divides sixty.localeandtimeZoneName- a locale identifier such asen_GB, and an IANA time zone such asEurope/London.timeZoneOffsetInMinutesgives the zone as an offset.controlSize-'mini','small','regular'or'large': AppKit's control size on macOS, and UIKit's on iOS 26 and later.accentColor,textColor(the wheels', fordisplayIOS="spinner") andthemeVariant-'dark','light'or'unspecified'.enabled-falserefuses input.change- the user picked a moment.$event.nativeEvent.timestampis the moment in milliseconds, andutcOffsetits UTC offset.pickerDismiss- the compact picker's popover closed.
The native views page covers the other community views.