简体   繁体   English

如何使用primeng禁用p-calender中的过去日期选择?

[英]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, 我正在使用primeng p-calender,但我要求不要将过去的日期发送到API,

So I want to disable past dates selection 所以我想禁用过去的日期选择

If anyone knows please, comment 如果有人知道,请发表评论

Thanks in advance 提前致谢

Documentation ref: https://www.primefaces.org/primeng/#/calendar 参考文献: https : //www.primefaces.org/primeng/#/calendar

in your .html 在您的.html中

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

via ts 通过ts

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM