Skip to content

fix(message): render message instants through one shared UTC-based formatter - #5231

Closed
123123213weqw wants to merge 2 commits into
apache:rocketmq-studiofrom
123123213weqw:fix/yy-message-time-shared-utc-formatter
Closed

123123213weqw wants to merge 2 commits into
apache:rocketmq-studiofrom
123123213weqw:fix/yy-message-time-shared-utc-formatter

Conversation

@123123213weqw

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #5219

Brief Description

The queue browser formatted store times with a hardcoded zh-CN locale in the browser zone and dropped the milliseconds, while the message page kept a second private formatter with local getters — the same message rendered three different strings, none zone-labeled. Both views now go through a shared formatMessageTime: epoch millis parsed (offset-less strings read as UTC per the formatUtcDateTime convention), rendered in the viewer's timezone with milliseconds kept and the zone labeled; dense columns and the trace timeline pass zone: false.

How Did You Test This Change

  • npx vitest run src/utils/format.test.ts src/components/__tests__/QueueBrowser.test.tsx — new formatter cases plus a shape pin that reddens on a zh-CN revert.
  • npx vitest run src/pages/instance/__tests__/ — 197/197 green.

The context-usage percent label carried fontSize: 13, below the project's
14px minimum. Raise it to 14 and pin it with a test that renders the
meter past its 1% visibility threshold and asserts no inline 13px text
remains in the composer.

Fixes apache#4941 (revives the stale-closed apache#4940)
…rmatter

The queue browser formatted store times with a hardcoded zh-CN locale in
the browser's zone and dropped the milliseconds, while the message page
kept a second private formatter with local getters; the same message
rendered three different strings across views, none labeled with a zone.

Both now go through formatMessageTime in utils/format: the instant is
parsed (epoch millis on the wire, offset-less strings read as UTC like
formatUtcDateTime), rendered in the viewer's timezone with milliseconds
kept and the zone labeled; dense columns and the trace timeline pass
zone:false so the suffix does not repeat on every row.

Fixes apache#5219
@yyqdbngt

Copy link
Copy Markdown
Contributor

Scoping note, per the convention from the #4458 review ("if you judge it out of scope, say so in the description"): the DLQ page (web/src/pages/instance/dlq.tsx:62) carries a third private timestamp formatter that also renders epoch-millis store times. It is deliberately NOT swept here because #5197 is in flight on that same file (last-enqueue-time UTC rendering); converting it here would make the two PRs mutually exclusive on the same hunks. Once #5197 lands, folding dlq.tsx into formatMessageTime is a mechanical follow-up — happy to do it immediately after.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

This pull request has been automatically closed because there has been no activity for 7 days. If you would like to continue working on this, please reopen the PR with updated changes.

@github-actions github-actions Bot added the stale label Oct 8, 2026
@github-actions github-actions Bot closed this Oct 8, 2026
@lizhimins

Copy link
Copy Markdown
Member

This pull request was closed by the stale bot on 2026-10-08 (seven days without activity), not by a maintainer decision - the review below is what we had queued for it.

Thanks for this. The core of it has since landed on rocketmq-studio: #4829 ("share one message
timestamp formatter") already deleted both private formatters this PR targets — QueueBrowser.tsx
now imports formatTimeMs from utils/format (line 38) and message.tsx does the same (line 77),
with milliseconds kept. That is why the branch conflicts in three files and why the new
QueueBrowser.test.tsx case targets a describe('formatTimeMs') block that no longer exists there.
The remaining idea — labelling the viewer's zone on message instants — runs against the format
#4829 pinned as console-wide (format.ts:36-42 javadoc plus the $-anchored shape regex in
format.test.ts:103). If you still want it, please open a fresh issue/PR that adds a zone option to
the existing shared formatTimeMs and updates that pinned shape, rather than introducing a second
formatter. We are treating this one as superseded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants