Open MoreThanCarbon opened 8 years ago
Since the initial date value is a timestamp of 'new Date()' the datepicker selected date does not match any date on the calendar. I was able to get around this by changing:
private initValue(): void { setTimeout(() => { if (!this.initDate) { this.setValue(moment().format(this.modelFormat || 'YYYY-MM-DD')); } else { this.setValue(moment(this.initDate, this.modelFormat || 'YYYY-MM-DD')); } }); }
to
private initValue(): void { setTimeout(() => { if (!this.initDate) { this.setValue(moment().startOf('day').format(this.modelFormat || 'YYYY-MM-DD')); } else { this.setValue(moment(this.initDate, this.modelFormat || 'YYYY-MM-DD')); } }); }
on the ng2-datepicker/src/components/ng2-datepicker.ts page.
Hey, can you post a PR for this please?
Since the initial date value is a timestamp of 'new Date()' the datepicker selected date does not match any date on the calendar. I was able to get around this by changing:
to
on the ng2-datepicker/src/components/ng2-datepicker.ts page.