react-datepicker
react-datepicker copied to clipboard
onBlur callbacks in console example code has typo's
Expected behavior
The example code for onBlur callbacks in console has some typos that are confusing when trying to understand the example.
handleOnBlur: function (date) { // <- date shoulde be event
const date = new Date(event.target.value);
if (isValid(date)) {
console.log("selected date: %s", format(date, "dd/MM/yyyy")); // <- Maybe include 'Valid' in string
} else {
console.log("selected date: %s", event.target.value); // <- Maybe include 'Invalid' in string
}
};'} // <- Remove unwanted '}
Actual behavior
Should be
handleOnBlur: function (event) {
const date = new Date(event.target.value);
if (isValid(date)) {
console.log("Valid selected date: %s", format(date, "dd/MM/yyyy"));
} else {
console.log("Invalid selected date: %s", event.target.value);
}
};
Would appreciate if you can submit a PR for this.
@martijnrusschen Will try to get round to it.
This was fixed in #1548.
Awesome, thanks!