Returns empty string when no date in date converter (#493)

This commit is contained in:
Tek 2024-04-30 16:51:58 +02:00 committed by GitHub
parent cbd41b2aff
commit 9d47acc228
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -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)