Skip to content

Commit e60f731

Browse files
committed
refactor(picker): add string type to allowed proptypes
1 parent 81858f6 commit e60f731

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/index.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ class DatetimeRangePicker extends Component {
2323
static getDerivedStateFromProps(nextProps, prevState) {
2424
return nextProps.startDate === prevState.startDate && nextProps.endDate === prevState.endDate
2525
? {}
26-
: {
27-
start: moment(nextProps.startDate) || moment(),
28-
end: moment(nextProps.endDate) || moment(),
29-
startDate: nextProps.startDate,
30-
endDate: nextProps.endDate,
26+
: {
27+
start: moment(nextProps.startDate) || moment(),
28+
end: moment(nextProps.endDate) || moment(),
29+
startDate: nextProps.startDate,
30+
endDate: nextProps.endDate,
3131
}
3232
}
3333

@@ -113,7 +113,7 @@ class DatetimeRangePicker extends Component {
113113
if (typeof date === 'string') {
114114
return;
115115
}
116-
116+
117117
const options = {
118118
start: date,
119119
};
@@ -132,7 +132,7 @@ class DatetimeRangePicker extends Component {
132132
if (typeof date === 'string') {
133133
return;
134134
}
135-
135+
136136
this.setState({ end: date }, () => {
137137
this.props.onChange(this.propsToPass());
138138
this.props.onEndDateChange(this.propsToPass().end);
@@ -247,8 +247,8 @@ DatetimeRangePicker.propTypes = {
247247
defaultEndDate: PropTypes.oneOfType([PropTypes.instanceOf(moment), PropTypes.instanceOf(Date)]),
248248
endDate: PropTypes.oneOfType([PropTypes.instanceOf(moment), PropTypes.instanceOf(Date)]),
249249
endTimeConstraints: PropTypes.object, // eslint-disable-line
250-
startDate: PropTypes.oneOfType([PropTypes.instanceOf(moment), PropTypes.instanceOf(Date)]),
251-
defaultStartDate: PropTypes.oneOfType([PropTypes.instanceOf(moment), PropTypes.instanceOf(Date)]),
250+
startDate: PropTypes.oneOfType([PropTypes.instanceOf(moment), PropTypes.instanceOf(Date), PropTypes.string]),
251+
defaultStartDate: PropTypes.oneOfType([PropTypes.instanceOf(moment), PropTypes.instanceOf(Date), PropTypes.string]),
252252
startTimeConstraints: PropTypes.object, // eslint-disable-line
253253
dateFormat: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
254254
timeFormat: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),

0 commit comments

Comments
 (0)