I'm having trouble setting a default date in the datepicker. I attempted to use the defaultDate property of p-calendar, here's what I did:
<p-calendar placeholder="mm/dd/yyyy"
name="deadline"
required
[(ngModel)]="deadline"
#deadline="ngModel"
[showIcon]="true"
showTime="showTime"
hourFormat="12"
[defaultDate]="defaultDate">
Here's my Component.ts code:
public defaultDate: Date = new Date();
ngOnInit() {
this.defaultDate.setDate(this.defaultDate.getDate() - 5);
}
Unfortunately, the above solution isn't working as expected. Can anyone provide assistance with this issue?