Search code examples
angularangular5primengprimeng-calendar

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


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


Solution

  • 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);