Skip to content

Instantly share code, notes, and snippets.

@edwinlab
Created July 29, 2016 03:28
Show Gist options
  • Save edwinlab/f7e7fc0a3e2ad295719d531a94e8f56e to your computer and use it in GitHub Desktop.
Save edwinlab/f7e7fc0a3e2ad295719d531a94e8f56e to your computer and use it in GitHub Desktop.
Checking string is valid date
def validate_date date
begin
Date.parse(date)
rescue ArgumentError
Date.today
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment