We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b3d954 commit bda8ca3Copy full SHA for bda8ca3
server/utils/datetime_utils.py
@@ -6,7 +6,7 @@
6
import re
7
import pytz
8
from typing import Union, Optional
9
-from zoneinfo import ZoneInfo
+from zoneinfo import ZoneInfo, ZoneInfoNotFoundError
10
import email.utils
11
import conf
12
# from const import *
@@ -214,7 +214,7 @@ def format_date_iso(date_val: str) -> Optional[str]:
214
# Resolve target timezone; fall back to UTC if conf.tz is missing/invalid
215
try:
216
target_tz = conf.tz if isinstance(conf.tz, datetime.tzinfo) else ZoneInfo(conf.tz)
217
- except Exception:
+ except (ZoneInfoNotFoundError, ValueError, TypeError):
218
target_tz = datetime.UTC
219
dt = dt.astimezone(target_tz)
220
0 commit comments