From 7450bba4291726fd2853d97043bebceee0b6a6d3 Mon Sep 17 00:00:00 2001 From: feyy Date: Wed, 18 Oct 2017 20:48:57 +0800 Subject: [PATCH] fix(datepicker): fix warns when pass moment instance to date prop #166 --- datepicker.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/datepicker.js b/datepicker.js index 3f95d5eb06..1a68a64823 100644 --- a/datepicker.js +++ b/datepicker.js @@ -184,12 +184,12 @@ class DatePicker extends Component { this.setState({ allowPointerEvents: false, date: date - }) + }); const timeoutId = setTimeout(() => { this.setState({ allowPointerEvents: true - }) - clearTimeout(timeoutId) + }); + clearTimeout(timeoutId); }, 200); } @@ -305,7 +305,7 @@ class DatePicker extends Component { } = this.props; if (showIcon) { - if (!!iconComponent) { + if (iconComponent) { return iconComponent; } return ( @@ -452,7 +452,7 @@ DatePicker.defaultProps = { DatePicker.propTypes = { mode: PropTypes.oneOf(['date', 'datetime', 'time']), androidMode: PropTypes.oneOf(['calendar', 'spinner', 'default']), - date: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]), + date: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date), PropTypes.object]), format: PropTypes.string, minDate: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]), maxDate: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]),