简体   繁体   English

如何禁用角度P日历中的过去日期?

[英]How can I disable past dates in angular p-calendar?

I am using p-calendar 我正在使用P日历

I would like all past dates to be disabled 我希望所有过去的日期都被禁用

here is what I have : 这是我所拥有的:

 <p-calendar formControlName="date" [inline]="true" tabindex="0" [disabledDates]="invalidDates" [disabledDays]="[0,6]"></p-calendar>

This is not working, what do I need to change to get the result I want ? 这不起作用,我需要更改什么才能获得所需的结果?

The calendar has a minDate input. 日历具有minDate输入。 Just set it to the current date, that way it cannot be lower than today. 只要将其设置为当前日期,就不能低于今天。

In the code: 在代码中:

minimumDate = new Date();

In the template: 在模板中:

<p-calendar formControlName="date" [inline]="true" [minDate]="minimumDate" tabindex="0" [disabledDates]="invalidDates" [disabledDays]="[0,6]"></p-calendar>

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

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