p-calendar does not accept null value when showTime is set
When i set option 'showTime' to true and on UI I'll delete value from input, p-calendar sets invalid state to form.
Maybe some null checks here will help:
selectDate(dateMeta) {
if(this.utc)
this.value = new Date(Date.UTC(dateMeta.year, dateMeta.month, dateMeta.day));
else
this.value = new Date(dateMeta.year, dateMeta.month, dateMeta.day);
if(this.showTime) {
if(this.hourFormat === '12' && this.pm && this.currentHour != 12)
//null here
this.value.setHours(this.currentHour + 12);
else
//and null there, yupi!
this.value.setHours(this.currentHour);
this.value.setMinutes(this.currentMinute);
this.value.setSeconds(this.currentSecond);
}
this._isValid = true;
this.updateModel();
this.onSelect.emit(this.value);
}
Please fix it or add option nullable to p-calendar...
Sample code: <p-calendar id="toDate" placeholder="Data do" formControlName="toDate" dateFormat="dd-mm-yy" [showTime]="true" hourFormat="24">
Hi,
So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap? Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!
Best Regards,