i have a problem. I have written this code to display datepicker:
<input [(ngModel)]="dateCalendar" ngbDatepicker #d1="ngbDatepicker" (ngModelChange)="onPickerChange()">
<span style="cursor:pointer;color:black" (click)="d1.toggle()"><i ></i></span>
But when i try to update the datepicker from typescript (i use angular), it doesn't work.
I tried to update dateCalendar
with: this.dateCalendar.month = this.dateCalendar.month 1
but the datepicker input turns blank. Why? The structure of dateCalendar is:
dateCalendar = {
year: parseInt(moment().format('Y')),
month: parseInt(moment().format('M')),
day: parseInt(moment().format('D'))
};
Can anyone help me? Thanks a lot What is the correct format to update datepicker?
CodePudding user response:
This works fine as expected stackblitz