Use of customInput that does not call onChange with an event objet
Expected behavior
DatePicker.onChange() to accept any argument (not just an event). If the argument is not an event, the function should not throw an error. Check if event is an object and if it has the property isDefaultPrevented as a function:
Relevant code: https://github.com/Hacker0x01/react-datepicker/blob/master/src/index.jsx#L275
if (typeof event != "object" || typeof event.isDefaultPrevented != "function" || event.isDefaultPrevented()) {
Actual behavior
DatePicker.onChange() expects there to be only one argument: the change event. If the argument does not have the function isDefaultPrevented, an error is thrown.
Steps to reprodcue
Use any customInput on a DatePicker that does not return an object with isDefaultPrevented as a function property.
Simple case: https://codesandbox.io/s/q3vw0j670q
Further, keeping in line with the notion that the first argument might not be an event, there could be a case where there are additional arguments. For that, I suggest we invoke onChangeRaw using apply: onChangeRaw.apply(this, arguments)
If there are no objections to the suggested solutions, I can create a pull request.
This is fixed by #1230 , isn't it?