日历中的 selectionMode 范围不适用于月份 - primeNG

selectionMode range in calendar doesn't work for month - primeNG

component.html

<p-calendar
    view="month"
    [yearNavigator]="true"
    yearRange="2000:2030"
    [(ngModel)]="rangeDates"
    showButtonBar="true"
    [showTransitionOptions]="'0ms'"
    [hideTransitionOptions]="'0ms'"
    placeholder="Select time period"
    selectionMode="range"
    dateFormat="mm/yy">
   <p-header>Header</p-header>
   <p-footer>Footer</p-footer>
</p-calendar>

component.ts

import { Component } from '@angular/core';

    @Component({
      selector: 'my-app',
      templateUrl: 'app/app.template.html'
    })

    export class AppComponent {
        dates: Date[];
        rangeDates: Date[];
    }

我正在尝试 select PrimeNg 日历中的一个月范围,但它不起作用我正在低于 错误。

ERROR TypeError: this.value.getMonth is not a function

使用您的确切代码对我有用。我用 Angular 7.2.15 和 PrimeNG 7.1.3

进行了测试

我在处理日期范围为空日期数组但不是独立值的模型时看到此错误。您可能会考虑尝试在 Stackblitz 上重新创建它,或者如果使用旧版本,请尽可能更新到新版本。