Skip to content

Instantly share code, notes, and snippets.

@johndagostino
Created February 25, 2014 03:38
Show Gist options
  • Save johndagostino/9202215 to your computer and use it in GitHub Desktop.
Save johndagostino/9202215 to your computer and use it in GitHub Desktop.
WTF.rb
result = case value
when nil,""
nil
when /^\d{1,2}-\d{1,2}-\d{2}$/
Date.strptime(value, $DEFAULT_DATE_FORMAT.downcase)
else
Date.strptime(value, $DEFAULT_DATE_FORMAT)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment