From 16c1d4dc2b48a2f68091d5985c7e76f02de80307 Mon Sep 17 00:00:00 2001 From: Alireza Date: Sat, 22 Jun 2019 15:32:47 +0100 Subject: [PATCH] hot fix for updating controlled values --- src/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index acd8c32..63a65d0 100644 --- a/src/index.js +++ b/src/index.js @@ -65,7 +65,9 @@ class JDatePicker extends React.Component { preSelected !== this.state.selectedDay ) this.setState({ - selectedDay: moment(preSelected, format).format("jYYYYjMMjDD"), + selectedDay: preSelected.length > 1 + ? moment(preSelected, this.props.format).format("jYYYYjMMjDD") + : "", inputValue: preSelected }); }