DatePicker
<DatePicker>
is a UI component that lets users select a date from a pre-configured range.
See also: TimePicker.
<ActivityIndicator [busy]="isBusy" (busyChange)="onBusyChanged($event)">
</ActivityIndicator>
import { ActivityIndicator } from '@nativescript/core'
onBusyChanged(args: EventData) {
const indicator: ActivityIndicator = args.object
console.log(`indicator.busy changed to: ${indicator.busy}`)
}
<DatePicker
year="1980"
month="4"
day="20"
loaded="onDatePickerLoaded"
date="{{ date }}"
minDate="{{ minDate }}"
maxDate="{{ maxDate }}"
/>
import { Component } from '@angular/core'
import { DatePicker } from '@nativescript/core'
@Component({
moduleId: module.id,
templateUrl: './usage.component.html'
})
export class DatePickerUsageComponent {
minDate: Date = new Date(1975, 0, 29)
maxDate: Date = new Date(2045, 4, 12)
onDatePickerLoaded(args) {
// const datePicker = args.object as DatePicker;
}
onDateChanged(args) {
console.log('Date New value: ' + args.value)
console.log('Date value: ' + args.oldValue)
}
onDayChanged(args) {
console.log('Day New value: ' + args.value)
console.log('Day Old value: ' + args.oldValue)
}
onMonthChanged(args) {
console.log('Month New value: ' + args.value)
console.log('Month Old value: ' + args.oldValue)
}
onYearChanged(args) {
console.log('Year New value: ' + args.value)
console.log('Year Old value: ' + args.oldValue)
}
}
import { EventData } from '@nativescript/core'
;<datePicker
date={new Date()}
onDateChange={(args: EventData) => {
const datePicker = args.object
}}
/>
<datePicker date="{someDate}" />
<datePicker>
provides two-way data binding using bind
.
<datePicker bind:date="{selectedDate}" />
<DatePicker :date="someDate" />
<DatePicker>
provides two-way data binding using v-model
.
<DatePicker v-model="selectedDate" />
Props
Name | Type | Description |
---|---|---|
|
|
Gets or sets the complete date. |
|
|
Gets or sets the earliest possible date to select. |
|
|
Gets or sets the latest possible date to select. |
|
|
Gets or sets the day. |
|
|
Gets or sets the month. |
|
|
Gets or sets the year. |
|
|
Gets or set the UIDatePickerStyle of the date picker in iOS 13.4+.
Defaults to 0.
+ Valid values are numbers: + + |
|
|
Additional inherited properties not shown. Refer to the API Reference |