fix(local_time): handle date objects, not just datetime
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

ssl_expires_at is a date, not datetime — calling .tzinfo on it crashes.
Now checks hasattr(dt, 'hour') to distinguish date from datetime.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-04-07 08:18:30 +02:00
parent d57afc7b1a
commit fd7577ff67

3
app.py
View File

@ -227,6 +227,9 @@ def local_time_filter(dt, fmt='%d.%m.%Y %H:%M'):
"""Convert naive UTC datetime to Europe/Warsaw and format."""
if not dt:
return ''
# date objects (not datetime) — format directly, no timezone conversion
if not hasattr(dt, 'hour'):
return dt.strftime(fmt)
if dt.tzinfo is None:
dt = dt.replace(tzinfo=_UTC_TZ)
return dt.astimezone(_WARSAW_TZ).strftime(fmt)