From 601af676fdf1b41e60c8f87418a3584c85ec4dd7 Mon Sep 17 00:00:00 2001 From: Joni Salmi Date: Thu, 17 Jun 2021 18:38:16 +0300 Subject: [PATCH] Fix navigation when value is outside allowed range React widgets v5 example below where this is also an issue: ``` ; ``` We are however using V4 and its time picker and would appreciate if this can get patched there as well without having to create a fork. --- packages/react-widgets/src/Calendar.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-widgets/src/Calendar.js b/packages/react-widgets/src/Calendar.js index 05bfcaa80..5c2f21cb4 100644 --- a/packages/react-widgets/src/Calendar.js +++ b/packages/react-widgets/src/Calendar.js @@ -330,8 +330,9 @@ class Calendar extends React.Component { let { value, min, max } = this.props let { view } = this.state value = inRangeValue(value, min, max) + const oldValue = inRangeValue(prevProps.value, prevProps.min, prevProps.max); - if (!dates.eq(value, dateOrNull(prevProps.value), VIEW_UNIT[view])) + if (!dates.eq(value, oldValue, VIEW_UNIT[view])) this.maybeSetCurrentDate(value) }