react-datetime-picker
react-datetime-picker copied to clipboard
OnChange of Time sending null to change handler
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();
}