Skip to content

Commit 7450bba

Browse files
committed
fix(datepicker): fix warns when pass moment instance to date prop
xgfe#166
1 parent c57aece commit 7450bba

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

datepicker.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ class DatePicker extends Component {
184184
this.setState({
185185
allowPointerEvents: false,
186186
date: date
187-
})
187+
});
188188
const timeoutId = setTimeout(() => {
189189
this.setState({
190190
allowPointerEvents: true
191-
})
192-
clearTimeout(timeoutId)
191+
});
192+
clearTimeout(timeoutId);
193193
}, 200);
194194
}
195195

@@ -305,7 +305,7 @@ class DatePicker extends Component {
305305
} = this.props;
306306

307307
if (showIcon) {
308-
if (!!iconComponent) {
308+
if (iconComponent) {
309309
return iconComponent;
310310
}
311311
return (
@@ -452,7 +452,7 @@ DatePicker.defaultProps = {
452452
DatePicker.propTypes = {
453453
mode: PropTypes.oneOf(['date', 'datetime', 'time']),
454454
androidMode: PropTypes.oneOf(['calendar', 'spinner', 'default']),
455-
date: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),
455+
date: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date), PropTypes.object]),
456456
format: PropTypes.string,
457457
minDate: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),
458458
maxDate: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),

0 commit comments

Comments
 (0)