From 13459b0d70ff1b6e27ed62ab8351bf00ef32aff7 Mon Sep 17 00:00:00 2001 From: Valery Zakharchenko Date: Wed, 5 Dec 2018 14:58:41 +0200 Subject: [PATCH] fix: added fallback to getNow (#1140) When view changed and props `date === undefined` we have unexpected behavior for `handleRangeChange` and then for `onRangeChange` methods. It returns sometimes `undefined` and sometimes `Invalid Date`, so I suggest fix for this to provide default date if `date` prop isn't present. --- src/Calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Calendar.js b/src/Calendar.js index 888c58be6..999c8f8be 100644 --- a/src/Calendar.js +++ b/src/Calendar.js @@ -952,7 +952,7 @@ class Calendar extends React.Component { } let views = this.getViews() - this.handleRangeChange(this.props.date, views[view], view) + this.handleRangeChange(this.props.date || this.props.getNow(), views[view], view) } handleSelectEvent = (...args) => {