react-datetime-picker icon indicating copy to clipboard operation
react-datetime-picker copied to clipboard

OnChange of Time sending null to change handler

Open joebeernink opened this issue 3 years ago • 0 comments
trafficstars

Have had this working for a while, but something has broken with latest updates of NPM Packages: ("react-datetime-picker": "^3.2.1",

Have a datetime picker that calls the handler successfully if the date part of the datetime changes, but if you change the time, the value passed to the handler is always null. Anyone else seeing this?

                                <div>
                                    <DateTimePicker name="eventDate" onChange={handleEventDateChange} value={eventDate} />
                                    <span style={{ color: "red" }}>{eventDateErrors}</span>
                                </div>
        function handleEventDateChange(passedDate: Date) {

        if (isEventPublic && passedDate < new Date()) {
            setEventDateErrors("Public event cannot be in the past");
        }
        else {
            setEventDateErrors("");
            setEventDate(passedDate);
        }

        validateForm();
    }

joebeernink avatar Jun 12 '22 22:06 joebeernink