shlink-web-client/src/utils/DateRangeRow.js

41 lines
1 KiB
JavaScript
Raw Normal View History

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,
onEndDateChange: PropTypes.func.isRequired,
};
2020-01-14 22:12:30 +03:00
const DateRangeRow = ({ startDate, endDate, onStartDateChange, onEndDateChange }) => (
<div className="row">
2020-04-04 00:00:57 +03:00
<div className="col-md-6">
<DateInput
selected={startDate}
placeholderText="Since"
isClearable
maxDate={endDate}
2020-01-14 22:12:30 +03:00
onChange={onStartDateChange}
/>
</div>
2020-04-04 00:00:57 +03:00
<div className="col-md-6">
<DateInput
className="date-range-row__date-input"
selected={endDate}
placeholderText="Until"
isClearable
minDate={startDate}
onChange={onEndDateChange}
/>
</div>
</div>
);
DateRangeRow.propTypes = propTypes;
export default DateRangeRow;