fix: drive frontend timezone from yaml config
This commit is contained in:
@@ -27,9 +27,9 @@
|
||||
- Instances can scale horizontally; failure recovery requires no state synchronization
|
||||
- Only the production frontend gateway, dev frontend proxy and provider ingress are unrestricted public entries; core REST APIs and PostgreSQL remain on the Docker internal network or explicitly restricted host mappings. The dev frontend proxy rule is owned by `docs/reference/dev-environment.md`.
|
||||
- Frontend Time Zone Policy
|
||||
- All UniDesk frontend timestamps, dates, clocks, update times, heartbeat times, Trace times, Gantt axis labels, export date stamps, and `datetime-local` values must render as Beijing time.
|
||||
- Beijing time means IANA timezone `Asia/Shanghai` / UTC+8, regardless of the browser timezone, host system timezone, container timezone, or server-side `project.timezone` value.
|
||||
- Frontend code must use the shared formatter and input conversion helpers in `src/components/frontend/src/time.ts`; raw ISO/UTC timestamps may appear only inside explicitly opened raw JSON views.
|
||||
- All UniDesk frontend timestamps, dates, clocks, update times, heartbeat times, Trace times, Gantt axis labels, export date stamps, and `datetime-local` values must render from the single `config/frontend.yaml` `displayTime` source.
|
||||
- Frontend code must use the shared formatter and input conversion helpers in `src/components/frontend/src/time.ts`; these helpers read only the server-injected `data-config.displayTime` and do not fall back to browser, host, env, `config.json.project.timezone`, or hardcoded timezone values.
|
||||
- Upstream services and backend APIs should keep machine timestamps such as ISO/UTC values; Web rendering is the only layer that applies the configured display timezone. Raw ISO/UTC timestamps may appear only inside explicitly opened raw JSON views.
|
||||
- PostgreSQL Database
|
||||
- Deployed as a Docker container with a 10 GB named volume
|
||||
- Stores all task metadata, node heartbeats, resource labels, and business state
|
||||
|
||||
@@ -37,7 +37,11 @@ Code Queue 的 queue 合并弹窗是该公共组件的首个业务复用示例
|
||||
|
||||
## Time Zone Contract
|
||||
|
||||
frontend 所有默认可见的时间、日期、时钟、更新时间、心跳时间、Trace 时间、Gantt 时间轴刻度、导出文件日期和 `datetime-local` 输入值都必须按北京时间显示,即使用 IANA 时区 `Asia/Shanghai` / UTC+8。禁止依赖浏览器本地时区、服务器系统时区或裸 `Date.toLocaleString()` 默认值;新增页面必须复用 `src/components/frontend/src/time.ts` 的统一格式化和输入转换函数。原始 JSON 中的 ISO 时间戳只能在用户显式点击 `查看原始JSON` 后作为原始数据出现,默认结构化控件不得把 UTC/本地时区混入北京时间显示。
|
||||
frontend 默认可见的时间、日期、时钟、更新时间、心跳时间、Trace 时间、Gantt 时间轴刻度、导出文件日期和 `datetime-local` 输入值,只能在 Web 渲染层按 `config/frontend.yaml` 的 `displayTime` 配置显示。当前北京时间配置值写在 YAML 中;文档不得把具体时区、locale 或 label 复制成第二真相。
|
||||
|
||||
frontend Bun server 启动时必须读取并校验 `config/frontend.yaml`,再把 `displayTime` 注入 root `data-config`。浏览器端统一复用 `src/components/frontend/src/time.ts` 的格式化和输入转换函数;这些 helper 只读取 `data-config.displayTime`,不得从浏览器本地时区、服务器系统时区、env、`config.json.project.timezone` 或硬编码常量回退。
|
||||
|
||||
上游服务、任务 trace 和后端 API 应保持统一机器时间事实(例如 ISO/UTC timestamp),不得把本地时区展示字符串作为默认结构化控件的时间来源。原始 JSON 中的 ISO 时间戳只能在用户显式点击 `查看原始JSON` 后作为原始数据出现;默认 Web 控件负责按唯一 YAML 配置渲染。
|
||||
|
||||
## Layout
|
||||
|
||||
|
||||
Reference in New Issue
Block a user