Skip to content

Commit

Permalink
Show next and previous months when clicking outside days (see #97, fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl committed Dec 3, 2015
1 parent 96e7031 commit 8736051
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/DayPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,10 @@ export default class DayPicker extends Component {
const { numberOfMonths } = this.props;
const diffInMonths = Helpers.getMonthsDiff(currentMonth, day);
if (diffInMonths > 0 && diffInMonths >= numberOfMonths) {
const nextMonth = Helpers.addMonths(currentMonth, numberOfMonths);
this.showMonth(nextMonth);
this.showNextMonth();
}
else if (diffInMonths < 0) {
const prevMonth = Helpers.addMonths(currentMonth, -numberOfMonths);
this.showMonth(prevMonth);
this.showPreviousMonth();
}
}

Expand Down

0 comments on commit 8736051

Please sign in to comment.