import React, { useState } from 'react'; import { FormattedMessage } from 'react-intl'; import { isAfter } from 'date-fns'; import Calendar from 'components/common/Calendar'; import Button from 'components/common/Button'; import { FormButtons } from 'components/layout/FormLayout'; import { getDateRangeValues } from 'lib/date'; import styles from './DatePickerForm.module.css'; export default function DatePickerForm({ startDate: defaultStartDate, endDate: defaultEndDate, minDate, maxDate, onChange, onClose, }) { const [startDate, setStartDate] = useState(defaultStartDate); const [endDate, setEndDate] = useState(defaultEndDate); function handleSave() { onChange({ ...getDateRangeValues(startDate, endDate), value: 'custom' }); } return (