Skip to content

Commit

Permalink
Added checks for min and max date before trying to set the date to on…
Browse files Browse the repository at this point in the history
…e of them in the cause of the date being outside the valid range
  • Loading branch information
Brendon Page authored and admwx7 committed Nov 26, 2018
1 parent bebaf25 commit 7d01f02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions paper-calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,9 @@
}
if (!this._withinValidRange(date)) {
console.warn('Date outside of valid range: ' + date);
if (date.getFullYear() == this.maxDate.getFullYear()) {
if (this.maxDate && date.getFullYear() == this.maxDate.getFullYear()) {
this.date = this.maxDate;
} else if (date.getFullYear() == this.minDate.getFullYear()) {
} else if (this.minDate && date.getFullYear() == this.minDate.getFullYear()) {
this.date = this.minDate;
} else {
this.date = date = oldValue;
Expand Down

0 comments on commit 7d01f02

Please sign in to comment.