Created
May 23, 2011 14:47
-
-
Save jamescook/986812 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def valid_dob? value | |
begin | |
date = Date.parse value | |
if date.year < 1900 || date.year > Date.today.year #some sensible years | |
return false | |
end | |
return true | |
rescue ArgumentError # malformed string | |
false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment