Skip to content

Commit

Permalink
Fixed #612 - viewDate.getMonth() is not a function
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Dec 4, 2018
1 parent c91a114 commit d272621
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/components/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,13 @@ export class Calendar extends Component {
super(props);

if (!this.props.onViewDateChange) {
let propValue = this.props.value;
if (Array.isArray(propValue)) {
propValue = propValue[0];
}

this.state = {
viewDate: (this.props.viewDate || this.props.value || new Date())
viewDate: (this.props.viewDate || propValue || new Date())
}
}

Expand Down Expand Up @@ -1013,8 +1018,11 @@ export class Calendar extends Component {
else if(this.isRangeSelection()) {
if(this.props.value[1])
return this.isDateEquals(this.props.value[0], dateMeta) || this.isDateEquals(this.props.value[1], dateMeta) || this.isDateBetween(this.props.value[0], this.props.value[1], dateMeta);
else
return this.isDateEquals(this.props.value[0], dateMeta)
else {
debugger;
return this.isDateEquals(this.props.value[0], dateMeta);
}

}
}
else {
Expand Down

0 comments on commit d272621

Please sign in to comment.