react-date-range icon indicating copy to clipboard operation
react-date-range copied to clipboard

Range picking doesn't persist when multiple printed in a .map()

Open VictorPietro opened this issue 3 years ago • 0 comments

Subject of the issue

Hi, I'm not sure why but when picking a date range using <DateRangePicker /> component, the range I've picked does not persist. When I console log values that have been selected, these values are correct, but visually, the calendar keeps the same as startDate and endDate. I'm not sure if I have to change something in the onChange() function - unable to localize it in doc. I also couldn't find any similar issue related to this.

[BUG] Bug Reproduce Steps

I've copied code from documented example and changed the range.

linksState.map((link, index) => (
        <DateRangePicker
            ranges={
                [{
                    startDate: (link.dateStart) ? link.dateStart : new Date(),
                    endDate: (link.dateEnd) ? link.dateEnd : addDays(new Date(), 7),
                    key: 'selection',
                }]
            }
           onChange={item => console.log(item)}
        />
);

[BUG] Expected behaviour

After picking a date range, this range should visually persist in the respective calendar.

Environment

Package Version: ^1.4.0 React version: 17.0.2 Node version: 16.5.0 Browser: Google Chrome

VictorPietro avatar Oct 21 '21 19:10 VictorPietro