Validating date in JavaScript
A very simple way to validate date in JavaScript.
function (mm, dd, yyyy) {
var d = new Date(mm + "/" + dd + "/" + yyyy);
return d.getMonth() + 1 == mm && d.getDate() == dd && d.getFullYear() == yyyy;
}
Check out "Do you speak JavaScript?" - my latest video course on advanced JavaScript.
Language APIs, Popular Concepts, Design Patterns, Advanced Techniques In the Browser
A very simple way to validate date in JavaScript.
function (mm, dd, yyyy) {
var d = new Date(mm + "/" + dd + "/" + yyyy);
return d.getMonth() + 1 == mm && d.getDate() == dd && d.getFullYear() == yyyy;
}