diff --git a/app/ui.py b/app/ui.py index 4423a98..60d3917 100644 --- a/app/ui.py +++ b/app/ui.py @@ -4126,7 +4126,7 @@ def system_dashboard(): r = rec.get("result", {}) total_freed = r.get("temp_bytes_freed", 0) + r.get("multipart_bytes_freed", 0) + r.get("orphaned_version_bytes_freed", 0) rec["bytes_freed_display"] = _format_bytes(total_freed) - rec["timestamp_display"] = datetime.fromtimestamp(rec["timestamp"], tz=dt_timezone.utc).strftime("%Y-%m-%d %H:%M UTC") + rec["timestamp_display"] = _format_datetime_display(datetime.fromtimestamp(rec["timestamp"], tz=dt_timezone.utc)) gc_history_records.append(rec) checker = current_app.extensions.get("integrity") @@ -4135,7 +4135,7 @@ def system_dashboard(): if checker: raw = checker.get_history(limit=10, offset=0) for rec in raw: - rec["timestamp_display"] = datetime.fromtimestamp(rec["timestamp"], tz=dt_timezone.utc).strftime("%Y-%m-%d %H:%M UTC") + rec["timestamp_display"] = _format_datetime_display(datetime.fromtimestamp(rec["timestamp"], tz=dt_timezone.utc)) integrity_history_records.append(rec) features = [ @@ -4163,6 +4163,7 @@ def system_dashboard(): gc_history=gc_history_records, integrity_status=integrity_status, integrity_history=integrity_history_records, + display_timezone=current_app.config.get("DISPLAY_TIMEZONE", "UTC"), ) diff --git a/templates/system.html b/templates/system.html index e351230..5138e3b 100644 --- a/templates/system.html +++ b/templates/system.html @@ -387,11 +387,18 @@ return (i === 0 ? b : b.toFixed(1)) + ' ' + units[i]; } + var _displayTimezone = {{ display_timezone|tojson }}; + function formatTimestamp(ts) { var d = new Date(ts * 1000); - var pad = function (n) { return n < 10 ? '0' + n : '' + n; }; - return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + - ' ' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ' UTC'; + try { + var opts = {year: 'numeric', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit', hour12: false, timeZone: _displayTimezone, timeZoneName: 'short'}; + return d.toLocaleString('en-US', opts); + } catch (e) { + var pad = function (n) { return n < 10 ? '0' + n : '' + n; }; + return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate()) + + ' ' + pad(d.getUTCHours()) + ':' + pad(d.getUTCMinutes()) + ' UTC'; + } } var _gcHistoryIcon = '' +