zjncs opened a new pull request, #5197:
URL: https://github.com/apache/rocketmq-dashboard/pull/5197
### Which Issue(s) This PR Fixes
- Fixes #<issue-id>
### Brief Description
The DLQ group's 最近入队时间 (last enqueue time) is wrong for every viewer outside
the server's timezone, in two cooperating ways:
1. **The backend shipped the server's wall clock.** `buildDLQGroup`
converted the broker's last-update epoch through `ZoneId.systemDefault()`, and
`LocalDateTime` serializes **without an offset** — so the wire value is a
zone-less wall clock in whatever zone the JVM happens to run in. Every other
`LocalDateTime` the backend produces is UTC by convention (the metrics and
alert subsystems write `ZoneOffset.UTC`, and the DB-backed times go through
JDBC `serverTimezone=UTC`); this was the one `ofInstant` conversion using the
default zone. It now converts with `ZoneOffset.UTC`.
2. **The frontend parsed it as browser-local.** The two `lastEnqueueTime`
render sites (group table column and the detail drawer) used the local-parse
`formatDateTime`, whose `new Date(value)` treats an offset-less string as the
viewer's zone. For a UTC server and a Shanghai viewer the displayed time is 8
hours early; for a Shanghai server and a Berlin viewer it is 6 hours late. Both
sites now use `formatUtcDateTime` — the helper the user-management timestamps
fix introduced for exactly this wire format — which reads offset-less strings
as UTC and renders them in the viewer's zone with a `GMT+X` suffix.
The `storeTime` renders are untouched: those values are epoch millis, which
both helpers interpret correctly.
### How Did You Test This Change?
Backend — new `listDLQGroupsShouldReportLastEnqueueTimeAsUtcTest`: one DLQ
topic whose stats report `lastUpdateTimestamp = 2025-07-31T16:00:00Z`, the JVM
default zone forced to `Asia/Shanghai` (so a default-zone conversion yields a
different wall clock), asserting the VO holds the UTC `LocalDateTime`:
```
$ mvn test -Dtest=RocketMQDLQProviderTest
Tests run: 40, Failures: 0 # 39 before; the new test fails on the old
# systemDefault() code (expected 16:00, got
00:00 next day)
```
Frontend — new `renders the last enqueue time in the viewer timezone from
the offset-less UTC wire format`: the mocked group carries
`2026-07-24T10:00:00` (the real Jackson shape — no `Z`; the existing fixtures
all carry one, which is why both helpers agreed there and the bug was
invisible), `TZ` stubbed to `Asia/Shanghai`, asserting the row renders
`2026-07-24 18:00:00 GMT+8`:
```
$ NODE_OPTIONS=--no-experimental-webstorage npx --prefix web vitest run
--root web src/pages/instance/__tests__/DLQPage.test.tsx
Test Files 1 passed (1)
Tests 22 passed (22) # 21 before; the new test fails on the old
# formatDateTime render (shows 10:00:00,
no zone)
$ npx --prefix web eslint web/src/pages/instance/dlq.tsx # 0 errors (1
pre-existing warning)
$ npx --prefix web tsc -p web --noEmit # clean
```
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
(no new UI text)
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [x] New source files carry the ASF license header (no new files)
- [x] Documentation touched where behaviour changed (bug fix; displayed
value now correct, no behaviour change to document)
--
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]