Last active
October 25, 2018 12:52
-
-
Save aashish/5f31f64d868bd9a0e6d7652e6e22b450 to your computer and use it in GitHub Desktop.
Date validation
This file contains 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
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