Skip to content

Instantly share code, notes, and snippets.

@jamescook
Created May 23, 2011 14:47
Show Gist options
  • Save jamescook/986812 to your computer and use it in GitHub Desktop.
Save jamescook/986812 to your computer and use it in GitHub Desktop.
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