Published:
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.
I'm taking a break this week so I'm just going to share this snippet from my archives for adding a JQuery Validate rule which disallows any date greater than today.
$.validator.addMethod(
"datenotgreaterthantoday",
function(value, element) {
var currentDate = new Date();
var selectedDate = new Date(value);
return (currentDate >= selectedDate);
},
"You cannot select a date greater than today."
);
Reader Comments