zjncs opened a new pull request, #6666: URL: https://github.com/apache/rocketmq-dashboard/pull/6666
### Which Issue(s) This PR Fixes Fixes #6665 ### Brief Description The 本页 24h 触发 statistic parsed each rule's `lastTriggered` with a bare `new Date(...)`, but the value is the backend's UTC wall clock serialized **without an offset** — the lastTriggered *column* on the same page already parses the very same field with `formatUtcDateTime`, whose doc comment documents exactly this pitfall. In a UTC+8 viewer every rule triggered 16–24 hours ago shifted 8 hours out of the window (undercount); in UTC−8 the window overcounted. The column and the statistic disagreed about the same timestamp. The fix extracts the hardened offset-aware parse into a reusable `parseUtcDate` next to `formatUtcDateTime` (single source of truth for the wire format) and uses it for the statistic. Non-goals: no change to the wire format or the column rendering, and no other statistics are touched. ### How Did You Test This Change? - Red-green: the new test `counts a rule triggered 20 hours ago UTC in the 24h statistic in a non-UTC zone` (stubbed `TZ=Asia/Shanghai`, the established pattern in this suite's sibling tests) failed on the unmodified tree @ `e2f815fb` — the statistic read `0` — and passes after the fix, reading `1`. Re-verified by temporarily restoring the buggy parse on the same base: the test goes red again. - `parseUtcDate` itself is unit-tested: offset-less strings parse as UTC, `Z`/`+00:00` forms agree, empty/unparseable input returns `null` instead of an Invalid Date. - `npx vitest run src/pages/ops/__tests__/AlertsPage.test.tsx src/utils/format.test.ts` — **64/64 pass**. - `npx eslint` on the four touched files — 0 errors (5 pre-existing warnings on untouched lines); `npx tsc --noEmit` — clean. AI assistance was used; the failure was reproduced before changing production code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
