[英]Angular - How to disable particular date in Datepicker?
我想從“mat-datepicker”中禁用星期一。 所以這是我在 class 組件中的代碼。
dateFilter = (_date: any) =>{
let day = _date.getDay();
console.log(day);
return day != 1;
}
在我的模板文件中:
<input [matDatepicker]="picker" [matDatepickerFilter]="dateFilter" />
<mat-datepicker (closed)="ClosePicker($event)" #picker></mat-datepicker>
但是現在在實施這個之后,我在我的日歷上看不到任何日期。 在月份部分,我只看到那里有“二月”。 沒有其他月份顯示。 有誰知道如何解決這一問題? 如果需要,我願意分享更多代碼。
請使用 Min max function 到 select 並禁用某些日期周期
通過使用 Angular 材料
<mat-form-field style="width:130px;" appearance="fill">
<input style="position: relative;top: -7px;" [min]="nestedMinDate" matInput [matDatepicker]="picker3"
[(ngModel)]="nestedReorder.PromiseDate"
(change)="dateFormating(nestedReorder.PromiseDate,i,j)">
<mat-datepicker-toggle matSuffix [for]="picker3"></mat-datepicker-toggle>
<mat-datepicker #picker3></mat-datepicker>
</mat-form-field>
鍵入腳本代碼
this.minDate= formatDate(new Date(), 'yyyy-MM-dd', 'en');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.