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

41 lines
1 KiB
TypeScript
Raw Normal View History

import moment from 'moment';
import DateInput from './DateInput';
interface DateRangeRowProps {
startDate?: moment.Moment | null;
endDate?: moment.Moment | null;
onStartDateChange: (date: moment.Moment | null) => void;
onEndDateChange: (date: moment.Moment | null) => void;
disabled?: boolean;
}
const DateRangeRow = (
{ startDate = null, endDate = null, disabled = false, onStartDateChange, onEndDateChange }: DateRangeRowProps,
) => (
<div className="row">
2020-04-04 00:00:57 +03:00
<div className="col-md-6">
<DateInput
selected={startDate}
placeholderText="Since"
isClearable
maxDate={endDate ?? undefined}
2020-04-10 13:25:06 +03:00
disabled={disabled}
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
2020-12-12 18:55:01 +03:00
className="mt-2 mt-md-0"
selected={endDate}
placeholderText="Until"
isClearable
minDate={startDate ?? undefined}
2020-04-10 13:25:06 +03:00
disabled={disabled}
onChange={onEndDateChange}
/>
</div>
</div>
);
export default DateRangeRow;