angular12kendo-datepicker

Angular 12 kendo-datepicker disable past dates


I want to disable Past dates in Kendo Date Picker. How can I do?

  <kendo-datepicker [(value)]="oneTime.startDate" [disabled]="disableDates()"></kendo-datepicker>

  disableDates() {
    //return (this.currentDate.getTime()  (new Date()).getTime());
  }

Solution

  • <kendo-datepicker [(value)]="startDate" [disabledDates]="disabledDates"></kendo-datepicker>
    
      public disabledDates = (date: Date): boolean => {
        const yesterday = (d => new Date(d.setDate(d.getDate() - 1)))(new Date);
        return (date.getTime() < yesterday.getTime());
      };