From 9d47acc2289c9218c3815825b61268ce1771a1e1 Mon Sep 17 00:00:00 2001 From: Tek Date: Tue, 30 Apr 2024 16:51:58 +0200 Subject: [PATCH] Returns empty string when no date in date converter (#493) --- mvt/common/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mvt/common/utils.py b/mvt/common/utils.py index 12f42b19..2ec6bbda 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)