Skip to content

Commit 068beeb

Browse files
committed
refactor(datepicker): refactor propTypes date with React.PropTypes.instanceOf
1 parent f2c2a5e commit 068beeb

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,7 @@ DatePicker.defaultProps = {
287287

288288
DatePicker.propTypes = {
289289
mode: React.PropTypes.oneOf(['date', 'datetime', 'time']),
290-
date: React.PropTypes.oneOfType([React.PropTypes.string, function(props, propName) {
291-
if (!(props[propName] instanceof Date)) {
292-
return new Error('Should be string or Date');
293-
}
294-
}]),
290+
date: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.instanceOf(Date)]),
295291
height: React.PropTypes.number,
296292
duration: React.PropTypes.number,
297293
confirmBtnText: React.PropTypes.string,

0 commit comments

Comments
 (0)