the problem is that range within react-date-range is not definable by two clicks, only by dragging. First click changes startDate and endDate to the same date instead of allowing me to click second time to set endDate.
Anyone knows the solution, what to do to allow user to click two times to set start and end dates?
Below is the state and component placed in parent component:
const [data, setData] = useState({
date: [
{
startDate: new Date(),
endDate: addDays(new Date(), 6),
key: 'selection',
},
],
});
<DateRangePickerCalendar
dateRange={data.date}
handleSelectDate={handleSelectDate}
/>
Child component in which I am displaying DateRangePicker
<DateRangePicker
onChange={(item) =>
handleSelectDate([item.selection] as DateRangeType[])
}
moveRangeOnFirstSelection={false}
months={2}
ranges={dateRange}
direction={isTablet ? 'vertical' : 'horizontal'}
staticRanges={staticRanges}
inputRanges={copiedDefaultInputRanges}
locale={pl}
/>
I've tried to read the docs and use options provided here, but I couldn't find any proper solution.