问题描述
此代码正在处理stackblitz。但是当我尝试应用它时不起作用。 ng-zorro 8.5版
HTML
<nz-month-picker [(ngModel)]="testRange.date1.date" [nzDisabledDate]="disabledStartDate"
(ngModelChange)="onStartChange($event)" [nzFormat]="'MMMM - yyyy'" nzPlaceHolder="Select month">
</nz-month-picker>
<nz-month-picker [(ngModel)]="testRange.date2.date" [nzDisabledDate]="disabledEndDate"
(ngModelChange)="onEndChange($event,'to')" [nzFormat]="'MMMM - yyyy'" nzPlaceHolder="Select month">
</nz-month-picker>
TS
testRange = {
date1: {
date: new Date(this.year,1)
},date2: {
date: new Date(this.year,11,31)
}
};
disabledStartDate = (startValue: Date): boolean => {
if (!startValue || !this.testRange.date2.date) {
return false;
}
return startValue > this.testRange.date2.date;
}
disabledEndDate = (endValue: Date): boolean => {
if (!endValue || !this.testRange.date1.date) {
return false;
}
return endValue <= this.testRange.date1.date;
}
如何根据所选的FROM和TO禁用月份。
例如,选择日历FROM时FROM大于TO,而选择日历TO时TO小于FROM。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)