hypeserver / react-date-range

A React component for choosing dates and date ranges.
MIT License
2.6k stars 679 forks source link

onShownDateChanges not firing after range selection #473

Closed isacvale closed 3 years ago

isacvale commented 3 years ago

Subject of the issue

When you select a range that spans multiple months, at the end on selection the calendar takes you back to the initial date of the selection. That means changing the displayed month, which should trigger a onShownDateChange callback.

For example, if I star a selection on January 20 to February 10, the calendar will immediately return to January without triggering the callback.

[BUG] Bug Reproduce Steps

Add a prop onShownDateChange={() => console.log('shown date changes')} to DateRangePicker. Start a selection on January 20. Go to next month and select the range to finish on February 10. The calendar returns to January, but the callback will not have fired for this last jump.

[BUG] Expected behaviour

Either the month does not jump back to the start of the selection OR that jump triggers onSHowDateChange callback.

Environment

Package Version: 1.1.3 React version: 16.3.1 Node version: 12.21.0 Browser: Version 90.0.4430.212 (Official Build) (64-bit) / Ubuntu

kamyar commented 3 years ago

Duplicate of #452