Skip to content

Instantly share code, notes, and snippets.

@pelusium
Created January 11, 2017 14:58
Show Gist options
  • Save pelusium/03ad3b23fed1e9773a3d9aab1826db66 to your computer and use it in GitHub Desktop.
Save pelusium/03ad3b23fed1e9773a3d9aab1826db66 to your computer and use it in GitHub Desktop.
Jquery validator over 16 years
jQuery.validator.addMethod('isOver16', function(value, element) {
var birthDate = value.split('-');
var tempDate = new Date((parseInt(birthDate[2])+16), parseInt(birthDate[1]-1), parseInt(birthDate[0]));
return (tempDate <= new Date());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment