【问题标题】:PrimeNG p-calendar - disableDate formatPrimeNG p-calendar - disableDate 格式
【发布时间】:2018-05-08 14:02:27
【问题描述】:

我想禁用 primeNG 日历中的日期。

<p-calendar [(ngModel)]="dateValue" dateFormat="dd.mm.yy" [disabledDates]="[here are the dates]"></p-calendar>

例如,我想禁用日历中的日期,除了今天和明天。

【问题讨论】:

    标签: angular typescript primeng primeng-calendar


    【解决方案1】:

    你应该使用minDatemaxDate,而不是使用disabledDates

    HTML

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

    TS

    this.minDateValue = new Date();
    this.maxDateValue = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
    

    StackBlitz

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-17
      • 2023-04-07
      • 2017-02-21
      • 2018-09-12
      • 2021-02-09
      • 2019-04-16
      • 1970-01-01
      相关资源
      最近更新 更多