mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
fix(datepicker): max, min and date value binding handling (#10343)
This commit is contained in:
@ -8,6 +8,8 @@ export function navigatingTo(args: EventData) {
|
||||
}
|
||||
|
||||
export class SampleData extends Observable {
|
||||
minDate = new Date();
|
||||
maxDate = new Date(2030, 7, 1);
|
||||
displayDate = {
|
||||
day: new Date().getDate(),
|
||||
month: new Date().getMonth(),
|
||||
@ -18,6 +20,15 @@ export class SampleData extends Observable {
|
||||
};
|
||||
showTime = true;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
// setTimeout(() => {
|
||||
// // test dynamic min and max date changes
|
||||
// this.notifyPropertyChange('minDate', null);
|
||||
// this.notifyPropertyChange('maxDate', null);
|
||||
// }, 2000);
|
||||
}
|
||||
|
||||
dateChange(args) {
|
||||
console.log('dateChange:', (<DatePicker>args.object).date);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ year="{{displayDate?.year}}"
|
||||
minute="{{displayDate?.minute}}"
|
||||
second="{{{{displayDate?.second}}"-->
|
||||
<StackLayout padding="20">
|
||||
<DatePicker class="v-center text-center" width="{{ showTime ? 220 : 300}}" height="{{ showTime ? 100 : 250}}" showTime="{{ showTime }}" iosPreferredDatePickerStyle="{{showTime ? 2 : 1}}" dateChange="{{ dateChange }}" />
|
||||
<DatePicker class="v-center text-center" width="{{ showTime ? 220 : 300}}" height="{{ showTime ? 100 : 250}}" minDate="{{minDate}}" maxDate="{{maxDate}}" showTime="{{ showTime }}" iosPreferredDatePickerStyle="{{showTime ? 2 : 1}}" dateChange="{{ dateChange }}" />
|
||||
<GridLayout rows="auto" columns="auto,*">
|
||||
<Switch checked="true" col="0" checkedChange="{{checkedChange}}" />
|
||||
<Label text="Show Time" col="1" class="m-l-10" />
|
||||
|
Reference in New Issue
Block a user