How to disabled past days selection in p-calender using primeng?

2.5k views Asked by At

I am using primeng p-calender I have the requirement that not to send past dates to the API,

So I want to disable past dates selection

If anyone knows please, comment

Thanks in advance

1

There are 1 answers

1
Jacopo Sciampi On BEST ANSWER

Documentation ref: https://www.primefaces.org/primeng/#/calendar

in your .html

<p-calendar [(ngModel)]="dateValue" [minDate]="yesterday " [readonlyInput]="true"></p-calendar>

via ts

var today = new Date();
let yesterday = new Date($today);
yesterday.setDate($today.getDate() - 1);