From b9ab95933893ce6b158aa4a713783ffdb23c2c98 Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Mon, 21 Feb 2022 10:43:59 -0400 Subject: [PATCH] Make parsed datetime strings timezone aware only if needed --- program/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/utils.py b/program/utils.py index e89ba274..78481e83 100644 --- a/program/utils.py +++ b/program/utils.py @@ -35,7 +35,7 @@ def parse_datetime(date_string: str) -> datetime: except ValueError: parsed_datetime = datetime.strptime(date_string, "%Y-%m-%d %H:%M:%S%z") - return timezone.make_aware(parsed_datetime) + return timezone.make_aware(parsed_datetime) if timezone.is_naive(parsed_datetime) else parsed_datetime def parse_date(date_string: str) -> date: -- GitLab