Skip to content

Instantly share code, notes, and snippets.

@maxparm
Created April 9, 2012 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxparm/2345037 to your computer and use it in GitHub Desktop.
Save maxparm/2345037 to your computer and use it in GitHub Desktop.
JS - Is 21 Years Old?
function is21YearsOld(date) {
var now = new Date();
var date = new Date(date);
var old = new Date(now.getFullYear()-21, now.getMonth(), now.getDate());
return date.getTime()<old.getTime();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment