bleenco / ng2-datepicker

Angular2 Datepicker Component
http://ng2-datepicker.jankuri.com
MIT License
311 stars 236 forks source link

bugfix: fixed issues with min max date #360

Closed yadue closed 3 years ago

yadue commented 3 years ago

Min max options are working incorrectly:

If I set

minDate -> 15.06.2021, then it allows to select 01.06-15.06. First argument should be date, not this.options.minDate. Same situation for maxDate.

  private isDateSelectable(date: Date): boolean {
    if (this.options.minDate && isBefore(this.options.minDate, date)) {
      return false;    
    }
    if (this.options.maxDate && isAfter(this.options.maxDate, date)) {
      return false;
    }
    return true;
  }

This PR fixes it.

Is it fine now?

CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

jkuri commented 3 years ago

yes, I just published new version 12.0.0 to npm so you can use it. thanks!