react-datepicker
react-datepicker copied to clipboard
Adding the `showMonthYearDropdown` prop on the datepicker causes the app to hang/become-unresponsive.
Describe the bug
When I add the showMonthYearDropdown
prop shown here on the DatePicker
component, it kinda crashes/hangs the whole app, I'd have to restart the app or open it again in another tab.
To Reproduce, go to this codesandbox
Expected behavior The dropdown of both months & years to appear without the hassle and the app crashes/hangs.
Desktop (please complete the following information):
- OS: [Linux]
- Browser [Chromium, Firefox]
Additional context
This error is consistent regardless of React
version, I tried it with React
16.13 & 17.0
I'm experiencing the same thing. Using React 16.13.1
and Chrome 88 here. Any update on this bug?
I have the same issue. Just to clarify, as this is missing from the original bug description:
The DatePicker renders fine, and you can also select dates fine in the above sandbox. The app begins to "freeze" as soon as you want to open the montYearDropdown
. There is no error in the console or anything.
If you go to https://reactdatepicker.com/#example-monthyear-dropdown and then try to open montYearDropdown
, it also does not open. The date picker crashes with error as follows (same error appears in console) -
Error: Minified React error #188; visit https://reactjs.org/docs/error-decoder.html?invariant=188 for the full message
or use the non-minified dev environment for full errors and additional helpful warnings.
As per the link of the error decoder, the full text of the error is:
Unable to find node on an unmounted component.
The same issue with month year dropdown.
React v16.13.1;
react-datepicker 3.7.0;
Browser: chrome 89.0.4389.90 (Official Build) (x86_64),
OS: macOS Catalina v10.15.6;
Any updates of this bug?
I have the similar issue: I added datepicker with minDate and maxDate values and in this case datepicker works fine. when I remove props minDate and maxDate the app crashes when I try to open month selector
"react": "17.0.2", "react-datepicker": "^3.8.0", browser: chrome 92.0.4515.107 os: win10 home 19041.1110
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Any chance of this issue getting fixed. Been opened for nearly two years now...
I managed to fix this hang by specifying the dateFormatCalendar
, minDate
and maxDate
props. My theory is the dropdown needs the min/max dates to give the dropdown its range and not specifying them causes it to infinite loop.
dateFormatCalendar={"MMM yyyy"}
minDate={dayjs().subtract(7, 'month').toDate()}
maxDate={dayjs().add(7, 'month').toDate()}