format_time: output date/time in local tz, fixes #8802

This commit is contained in:
Thomas Waldmann 2025-04-30 18:11:29 +02:00
parent 2efe2bd9ee
commit f8aea242c7
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -89,9 +89,9 @@ def safe_timestamp(item_timestamp_ns):
def format_time(ts: datetime, format_spec=""):
"""
Convert *ts* to a human-friendly format with textual weekday.
Convert *ts* to a human-friendly format with textual weekday (in local timezone).
"""
return ts.strftime("%a, %Y-%m-%d %H:%M:%S %z" if format_spec == "" else format_spec)
return ts.astimezone().strftime("%a, %Y-%m-%d %H:%M:%S %z" if format_spec == "" else format_spec)
def format_timedelta(td):