apache / apache/rocketmq-dashboard

[Studio][Bug] Query history drawer renders UTC timestamps as browser-local time

Open Beginner friendly
#4,221 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 14h
Merged PRs (30d)
58

Description

## Problem

`MessageQueryHistoryDrawer` formats `queriedAt` / `latestQueryAt` with `new Date(value).toLocaleString()`. Backend `QueryHistoryService` stamps those fields with `Clock.systemUTC()` into a `LocalDateTime`, which serializes without a zone offset (`2026-08-05T12:00:00`). The browser therefore treats the value as **local** time and shifts the displayed timestamp by the viewer offset.

This is the same class of bug as the alert rule `lastTriggered` display issue (#4174 / #4199), but on the query-history surface.

## Evidence

- `web/src/components/MessageQueryHistoryDrawer.tsx` `formatTime` uses `toLocaleString()`.
- Backend: `QueryHistoryService` uses `Clock.systemUTC()`; VOs expose `LocalDateTime queriedAt` / `latestQueryAt` with no offset.
- Existing helper: `formatUtcDateTime` in `web/src/utils/format.ts` already appends `Z` for offset-less UTC strings and formats in the viewer timezone.

## Expected behavior

Query history timestamps are rendered as UTC-instant values in the viewer's timezone (via `formatUtcDateTime`), not as browser-local naive datetimes.

## Scope

Frontend drawer formatting + unit test. No API change.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in web/src/components/MessageQueryHistoryDrawer.tsx and inspect the formatTime handling for queriedAt and latestQueryAt. Compare it with formatUtcDateTime in web/src/utils/format.ts, then add the requested unit test. Done means offset-less UTC timestamps render as UTC instants in the viewer’s timezone without an API change.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript
Domain
frontend, testing
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.