Created
August 28, 2014 14:22
-
-
Save odlp/19d750af7d185bb1bd74 to your computer and use it in GitHub Desktop.
ISO8601 string
This file contains hidden or 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
def iso8601_string? datetime_str | |
(datetime_str =~ /\A\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)\z/) == 0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment