角度2 - kendo datepicker max和min不起作用

时间:2017-11-07 09:30:10

标签: angular kendo-ui

Kendo datepicker不起作用。谁能告诉我哪里弄错了?最小日期假设是今天的日期。这是示例代码: 的 app.html

<div [class]="datePickerClass">
    <kendo-datepicker class="kendo-datepicker" 
                        id="startDate"
                        [ngModel]="_startValue"
                        [min]="min"
                        [max]="max"
                        (ngModelChange)="startValueChanged($event)"
                        [format]="formatDisplay"></kendo-datepicker>
</div>
<div [class]="datePickerClass">
    <kendo-datepicker class="kendo-datepicker" 
                        id="endDate"
                        [ngModel]="_endValue"
                        [min]="min"
                        [max]="max"
                        (ngModelChange)="endValueChanged($event)"
                        [format]="'d MMM yyyy'"></kendo-datepicker>
</div>
<ng-content>
</ng-content>

app.ts

public min = new Date();
public max: Date = new Date(2017, 1, 1);

文件结构 Cities' IDs list

1 个答案:

答案 0 :(得分:1)

我最近遇到了同样的问题,请尝试以下方法:

private today = new Date();
public min: Date = new Date(this.today.getFullYear(), this.today.getMonth(), this.today.getDate());

这对我有用,也将“最大”改为11/7/2017后的某个日期:)