diff --git a/components/date_picker/DatePicker.js b/components/date_picker/DatePicker.js index 0ccc56e2..799e52ea 100644 --- a/components/date_picker/DatePicker.js +++ b/components/date_picker/DatePicker.js @@ -17,7 +17,10 @@ class DatePicker extends React.Component { maxDate: React.PropTypes.object, minDate: React.PropTypes.object, onChange: React.PropTypes.func, - value: React.PropTypes.object + value: React.PropTypes.oneOfType([ + React.PropTypes.instanceOf(Date), + React.PropTypes.string + ]) }; state = { @@ -41,7 +44,8 @@ class DatePicker extends React.Component { render () { const { inputClassName, value } = this.props; const inputFormat = this.props.inputFormat || time.formatDate; - const date = value ? inputFormat(value) : null; + const date = Object.prototype.toString.call(value) === '[object Date]' ? value : undefined; + const formattedDate = date === undefined ? inputFormat(value) : ''; return (
@@ -52,7 +56,7 @@ class DatePicker extends React.Component { label={this.props.label} readOnly type='text' - value={date} + value={formattedDate} />
);