From db6ed54879d9cd76e3a42ab3279781f16fd06365 Mon Sep 17 00:00:00 2001 From: tek Date: Mon, 29 Apr 2024 15:49:30 +0200 Subject: [PATCH] Returns empty string when no date in date converter --- mvt/common/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mvt/common/utils.py b/mvt/common/utils.py index 12f42b1..2ec6bbd 100644 --- a/mvt/common/utils.py +++ b/mvt/common/utils.py @@ -59,6 +59,9 @@ def convert_datetime_to_iso(date_time: datetime.datetime) -> str: :rtype: str """ + if not date_time: + return "" + if date_time.tzinfo: # Timezone aware object - convert to UTC date_time = date_time.astimezone(tz=datetime.timezone.utc)