This commit is contained in:
Franz König 2020-09-26 02:16:32 -04:00 committed by GitHub
commit 51e31b541c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -3032,7 +3032,10 @@ def date_from_str(date_str):
unit += 's'
delta = datetime.timedelta(**{unit: time})
return today + delta
return datetime.datetime.strptime(date_str, '%Y%m%d').date()
try:
return datetime.datetime.strptime(date_str, '%Y%m%d').date()
except ValueError:
sys.exit('ERROR: cannot parse datestring ' + date_str)
def hyphenate_date(date_str):