You should always specify a format when using momentJS's isValid(), as well as specifying strict, otherwise you can have unexpected outcomes.
For example, your example above would return true for the value of
"it is 12/25/25"
So you would need to do a conversion for each format you expect, but for just MM/DD/YYYY it would instead be:
Code:const inputBlur = function(e) { const value = e.target.value; const conversion = moment(value, 'MM/DD/YYYY', true); console.log(`${value} is valid: ${conversion.isValid()}`); }




Reply With Quote