apache / apache/rocketmq-dashboard
[Studio][Bug] User management renders UTC session timestamps as browser-local time
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 683
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 58
Description
## Problem
The Studio user management page renders lastSessionSeenAt,
earestSessionExpiresAt, passwordChangedAt, gmtCreate, and gmtModified with \
ew Date(value).toLocaleString()\. Those values are offset-less \LocalDateTime\ strings. JavaScript therefore treats them as browser-local wall-clock times, so every viewer outside UTC sees session activity and password-change times shifted by their UTC offset.
## Evidence
- \AuthService.now()\ (\server/src/main/java/org/apache/rocketmq/studio/auth/AuthService.java\) writes \LocalDateTime.ofInstant(Instant.ofEpochMilli(clock.millis()), ZoneOffset.UTC)\ into session \last_seen_at\ / \expires_at\ and user \password_changed_at\. The clock is \Clock.systemUTC()\.
- \StudioUserVO\ exposes those fields as \LocalDateTime\ (serialized without an offset).
- \UserManagement.tsx\ helper: \const dateTime = (value?: string) => (value ? new Date(value).toLocaleString() : '-');\ used by the table columns 最近活跃 / 最近过期 / 创建时间 and by the CSV export columns.
- Local reproduction (browser TZ \Asia/Shanghai\, UTC+8): \
ew Date('2026-08-22T09:30:00').toLocaleString()\ → \2026/8/22 09:30:00\ (wrong; should be 17:30 local). \
ew Date('2026-08-22T09:30:00Z').toLocaleString()\ → \2026/8/22 17:30:00\.
The same defect class was already fixed on other surfaces: alert \lastTriggered\ (#4174) and query-history \queriedAt\ (#4221 / #4222). The shared helper \ormatUtcDateTime\ in \web/src/utils/format.ts\ already appends \Z\ for offset-less values; user management never adopted it.
## Expected behavior
Render and export these timestamps with \ormatUtcDateTime\, matching the alert and query-history pages.
## Related
#4174, #4221, #4222
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with UserManagement.tsx and the shared format.ts helper, then compare the alert and query-history fixes referenced in the issue. Trace the dateTime helper through the user-management table and CSV export; done means all listed timestamps render and export with the same UTC conversion and local display as those other pages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100