2020-01-14 21:59:25 +03:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import DateInput from './DateInput';
|
|
|
|
import './DateRangeRow.scss';
|
|
|
|
|
|
|
|
const dateType = PropTypes.oneOfType([ PropTypes.string, PropTypes.object ]);
|
|
|
|
const propTypes = {
|
|
|
|
startDate: dateType,
|
|
|
|
endDate: dateType,
|
2020-01-14 22:12:30 +03:00
|
|
|
onStartDateChange: PropTypes.func.isRequired,
|
2020-01-14 21:59:25 +03:00
|
|
|
onEndDateChange: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
2020-01-14 22:12:30 +03:00
|
|
|
const DateRangeRow = ({ startDate, endDate, onStartDateChange, onEndDateChange }) => (
|
2020-01-14 21:59:25 +03:00
|
|
|
<div className="row">
|
2020-04-04 00:00:57 +03:00
|
|
|
<div className="col-md-6">
|
2020-01-14 21:59:25 +03:00
|
|
|
<DateInput
|
|
|
|
selected={startDate}
|
|
|
|
placeholderText="Since"
|
|
|
|
isClearable
|
|
|
|
maxDate={endDate}
|
2020-01-14 22:12:30 +03:00
|
|
|
onChange={onStartDateChange}
|
2020-01-14 21:59:25 +03:00
|
|
|
/>
|
|
|
|
</div>
|
2020-04-04 00:00:57 +03:00
|
|
|
<div className="col-md-6">
|
2020-01-14 21:59:25 +03:00
|
|
|
<DateInput
|
|
|
|
className="date-range-row__date-input"
|
|
|
|
selected={endDate}
|
|
|
|
placeholderText="Until"
|
|
|
|
isClearable
|
|
|
|
minDate={startDate}
|
|
|
|
onChange={onEndDateChange}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
DateRangeRow.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default DateRangeRow;
|