Skip to content

Commit 16f482b

Browse files
committed
fix(inputs): Fixing the resetState function
1 parent 6b75e1e commit 16f482b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/components/datepicker.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,18 @@ class SemanticDatepicker extends React.Component {
9595

9696
resetState = () => {
9797
const { onDateChange } = this.props;
98+
const initialSelectedDate = this.isRangeInput ? [] : null;
9899

99-
this.setState(this.initialState, () => {
100-
onDateChange(null);
101-
});
100+
this.setState(
101+
{
102+
isVisible: false,
103+
selectedDate: initialSelectedDate,
104+
selectedDateFormatted: '',
105+
},
106+
() => {
107+
onDateChange(null);
108+
}
109+
);
102110
};
103111

104112
mousedownCb = mousedownEvent => {

0 commit comments

Comments
 (0)