Created
March 12, 2020 18:11
-
-
Save smartworld-dm/04f5e0821274680604ea7883392839b4 to your computer and use it in GitHub Desktop.
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
def validate_iso8601_date(date_str): | |
regex = r'^([0-9]{4})-?(1[0-2]|0[1-9])-?(3[01]|0[1-9]|[12][0-9])$' | |
match_iso8601_date = re.compile(regex).match | |
try: | |
if match_iso8601_date( date_str ) is not None: | |
return True | |
except: | |
pass | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment