Skip to content

Instantly share code, notes, and snippets.

@aashish
Last active October 25, 2018 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aashish/5f31f64d868bd9a0e6d7652e6e22b450 to your computer and use it in GitHub Desktop.
Save aashish/5f31f64d868bd9a0e6d7652e6e22b450 to your computer and use it in GitHub Desktop.
Date validation
date = ARGV[0]
class Date
def self.valid?(date)
y, m, d = date.split '-'
date.match(/^\d{4}-\d{2}-\d{2}$/) && Date.valid_date?(y.to_i, m.to_i, d.to_i)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment