From ecdb4cc06e584bcd97439f5e7347a875e0c086ae Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sat, 10 Jul 2021 09:48:34 +0200 Subject: [PATCH] Fix parse_date --- pynyaata/utils.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pynyaata/utils.py b/pynyaata/utils.py index e09b6e4..b36738f 100644 --- a/pynyaata/utils.py +++ b/pynyaata/utils.py @@ -15,15 +15,17 @@ def link_exist_in_db(href): def parse_date(str_to_parse, date_format=''): if str_to_parse is None: - return datetime.fromtimestamp(0) + date_to_format = datetime.fromtimestamp(0) elif isinstance(str_to_parse, datetime): - return str_to_parse + date_to_format = str_to_parse else: date = parse(str_to_parse, date_formats=[date_format]) if date: - return date.isoformat(' ', 'minutes') + date_to_format = date 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):