From e71e6bc3d73130852b2aff27188e7b9298bb9df4 Mon Sep 17 00:00:00 2001 From: Jim McBride Date: Tue, 9 Dec 2025 08:16:04 -0600 Subject: [PATCH] Fix backup timestamp display to use UTC timezone The list_backups function was creating timezone-naive datetime objects, which caused the frontend to incorrectly interpret timestamps. Now uses datetime.UTC when creating timestamps from file modification time (consistent with other usage in this file on lines 186, 216), so the ISO string includes timezone info (+00:00). This allows the browser to properly convert UTC timestamps to the user's local timezone for display. Before: Backend sends "2025-12-09T14:12:44" (ambiguous timezone) After: Backend sends "2025-12-09T14:12:44+00:00" (explicit UTC) The frontend's toLocaleString() will now correctly convert to local time. --- apps/backups/services.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/backups/services.py b/apps/backups/services.py index db193607..d3d1a767 100644 --- a/apps/backups/services.py +++ b/apps/backups/services.py @@ -282,10 +282,12 @@ def list_backups() -> list[dict]: backups = [] for backup_file in sorted(backup_dir.glob("dispatcharr-backup-*.zip"), reverse=True): + # Use UTC timezone so frontend can convert to user's local time + created_time = datetime.datetime.fromtimestamp(backup_file.stat().st_mtime, datetime.UTC) backups.append({ "name": backup_file.name, "size": backup_file.stat().st_size, - "created": datetime.datetime.fromtimestamp(backup_file.stat().st_mtime).isoformat(), + "created": created_time.isoformat(), }) return backups