Files
Nexus/docs/changelog/2026-06-08-beijing-time-display-unified.md
T
Nexus Agent abeab9d3e4 Fix recovery Telegram dedup and unify Beijing time display.
Store alert metrics without per-value Redis members to stop duplicate recovery pushes; format all operator-facing timestamps in Asia/Shanghai across Web UI and Telegram.
2026-06-08 23:18:56 +08:00

1.5 KiB
Raw Blame History

2026-06-08 — 全站用户可见时间统一为北京时间

变更摘要

存储与计算仍用 UTC;所有面向运维的展示层Web 表格、Telegram、设置页刷新时间等)统一为 Asia/Shanghai 北京时间。

动机

用户要求不论浏览器时区,界面与通知时间与国内运维习惯一致。

方案

  • 后端server/utils/display_time.pyformat_beijing / format_beijing_now);Telegram、IP 白名单刷新时间、Telegram 测试消息接入
  • 前端frontend/src/utils/datetime.tsparseApiDateTime 将 MySQL naive UTC 正确解析 + formatDateTimeBeijing 等);15 页相关表格/内联详情/WS 告警条改用该工具

涉及文件

  • server/utils/display_time.py(新)
  • server/infrastructure/telegram/__init__.py
  • server/background/ip_allowlist_refresh.py
  • server/api/settings.py
  • frontend/src/utils/datetime.ts(新)
  • frontend/src/utils/status.ts
  • frontend/src/composables/push/labels.ts
  • frontend/src/composables/useWebSocket.ts
  • 多页 VueAlerts Audit Commands Retries Schedules Scripts ScriptRuns Servers 及凭据/子机内联组件

迁移 / 重启

  • 无 DB 迁移
  • 需重新构建前端并重启 API

验证方式

.venv/bin/python -m pytest tests/test_display_time.py tests/test_telegram_time_format.py tests/test_agent_recovery_dedup.py -q
cd frontend && npm run type-check

浏览器:告警历史、审计、推送历史等列时间应为北京时间(与 UTC 差 8 小时)。