[Bug] Snapshot timestamps differ between the VM view and the cluster overview
Describe the bug
The same snapshot shows a different time depending on which view you open. The cluster-wide snapshot overview renders it in UTC, the per-VM snapshot list renders it in the browser timezone. In CEST that is a two-hour difference on the same snapshot.
Reported by an operator, who correctly suspected timezones.
Steps to Reproduce
- Create a snapshot on any VM.
- Open the VM, go to its snapshot list, note the timestamp.
- Go to the cluster-wide snapshot overview and find the same snapshot.
- The two timestamps differ by the UTC offset of the browser.
Expected behavior
Both views show the same local time, and both respect the 12h/24h preference like the rest of the UI.
Environment
- PegaProx Version: 1.2.0
- Installation Method: Docker
- OS: Debian 13
- Browser: Chrome latest
- Behind Reverse Proxy? No
- UI? Corporate
Logs
n/a - display only
Screenshots
n/a
Checklist
- [x] I have searched existing issues to make sure this is not a duplicate
- [x] I am using the latest version of PegaProx
- [x] I have put enough in here that someone can start on it without asking me three questions first
- [x] I understand PegaProx is maintained by volunteers in their free time
Cause, since I had a look already:
pegaprox/api/vms.py,/api/snapshots/overviewformats server-side in UTC:datetime.fromtimestamp(snap_ts, tz=timezone.utc)thenstrftime("%Y-%m-%d %H:%M"), andweb/src/dashboard.jsprints that string verbatim.web/src/vm_config.jsandweb/src/vm_modals.jsdonew Date(snap.snaptime * 1000).toLocaleString(), i.e. browser-local, and bypass the sharedfmtDate()so they also ignore the 12h/24h setting.
Suggested fix: return the raw epoch from the overview next to the existing field and render both places through fmtDate().
Fixed on Testing (152b782 + 6ffbf65).
Went with your suggestion — the overview hands over the raw epoch now and all three places render through fmtDate(), which already handles epoch seconds and already respects the 12h/24h setting. That also picks up the second half of the report: the two per-VM lists were bypassing fmtDate entirely, so they ignored that preference as well.
Kept snapshot_date in the payload. The overview table sorts on it, and an older frontend hitting a newer backend shouldn't break. There's a test pinning that the string and the epoch stay in agreement so they can't quietly drift.
The cluster dialog also picked up the SSH toggle from #941 in the same build.
Marcus
The cluster snapshot overview now gets the raw snapshot time and shows it in the browser's local time, like the per-VM snapshot lists, so both views show the same time. All three places use the shared date formatter and follow the 12h/24h setting. This ships in 1.3.0.
Marcus