From 87360510796f3ca891319927d851a3d7b6f4e75c Mon Sep 17 00:00:00 2001 From: Giampaolo Bellavite Date: Thu, 3 Dec 2015 22:16:19 +0100 Subject: [PATCH] Show next and previous months when clicking outside days (see #97, fix #112) --- src/DayPicker.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/DayPicker.js b/src/DayPicker.js index 29d54daef6..6a79f6447a 100644 --- a/src/DayPicker.js +++ b/src/DayPicker.js @@ -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(); } }