Yes, there is a similar issue #4499, but it is reported for Android, whereas my issue is reproducible only on iOS.
You can't use [ngModel] binding in DatePicker, it throws error TypeError: null is not an object (evaluating 'value.getFullYear') and ignores bound date.
iOS
<DatePicker [ngModel]="date"></DatePicker> to some component template.date property of that component with new Date('2015-05-05').NativeScriptFormsModule to AppModule../node_modules/.bin/tns run iosSee attached sample project. The first DatePicker will have the correct date (because it is using [date] binding), the second DatePicker will have an incorrect date (because of [ngModel]).
Hello @otaran and thank you for reporting this issue. I can confirm that indeed the ngModel binding is not working as expected for date property on iOS.
Steps to reproduce the issue - use this demo app
As a workaround, you can use the extended syntax for the dateChange event.
e.g.
<DatePicker [date]="date" (dateChange)="onDateChanged($event)"></DatePicker>
and in the coomponent file
onDateChanged(args) {
console.dir(args);
}
This issue was moved to NativeScript/nativescript-angular#963
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Hello @otaran and thank you for reporting this issue. I can confirm that indeed the ngModel binding is not working as expected for date property on iOS.
Steps to reproduce the issue - use this demo app
As a workaround, you can use the extended syntax for the dateChange event.
e.g.
and in the coomponent file