Fix parse_date
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2021-07-10 09:48:34 +02:00
parent 7dc4babb5a
commit ecdb4cc06e

View File

@ -15,15 +15,17 @@ def link_exist_in_db(href):
def parse_date(str_to_parse, date_format=''): def parse_date(str_to_parse, date_format=''):
if str_to_parse is None: if str_to_parse is None:
return datetime.fromtimestamp(0) date_to_format = datetime.fromtimestamp(0)
elif isinstance(str_to_parse, datetime): elif isinstance(str_to_parse, datetime):
return str_to_parse date_to_format = str_to_parse
else: else:
date = parse(str_to_parse, date_formats=[date_format]) date = parse(str_to_parse, date_formats=[date_format])
if date: if date:
return date.isoformat(' ', 'minutes') date_to_format = date
else: else:
return datetime.fromtimestamp(0).isoformat(' ', 'minutes') date_to_format = datetime.fromtimestamp(0)
return date_to_format.isoformat(' ', 'minutes')
def boldify(str_to_replace, keyword): def boldify(str_to_replace, keyword):