Created
July 22, 2014 07:20
-
-
Save jcsrb/21107da479285d38d1a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var validateAgeOlderOrExactly = function(date_string, age_limit_year, age_limit_month) { | |
var ageLimitDate, birthDate, today; | |
if (age_limit_month == null) { | |
age_limit_month = 0; | |
} | |
today = new Date(); | |
birthDate = new Date(date_string); | |
ageLimitDate = new Date(today.getFullYear() - age_limit_year, today.getMonth() - age_limit_month, today.getDate()); | |
return birthDate <= ageLimitDate; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment