@devries-cameron20 / t3code-1 / commits / 31b5549f98
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): pull request comment tooltips follow the Time format setting (#35396)

Julius Marminge committed Nov 12, 2026 at 23:40 UTC 31b5549f98a9d1e139aa8c7756c9c93108c01c90
3 files changed +52 -3
apps/web/src/components/pullRequest/PullRequestSummaryTab.browser.test.tsx
+41 -2
@@ -1,9 +1,17 @@
1 -import { SourceControlProviderKind } from "@t3tools/contracts";
1 +import {
2 + DEFAULT_CLIENT_SETTINGS,
3 + SourceControlProviderKind,
4 + type ClientSettings,
5 +} from "@t3tools/contracts";
6 import { EnvironmentId, ProjectId, type PullRequestDetailView } from "@t3tools/contracts";
7 import { expect, it, vi } from "vite-plus/test";
8 import { userEvent } from "vite-plus/test/browser";
9
6 -const state = vi.hoisted(() => ({ update: vi.fn(), canUpdate: true }));
10 +const state = vi.hoisted(() => ({
11 + update: vi.fn(),
12 + canUpdate: true,
13 + timestampFormat: "locale" as "locale" | "12-hour" | "24-hour",
14 +}));
15
16 vi.mock(import("~/state/use-atom-command"), async (original) => ({
17 ...(await original()),
@@ -14,6 +22,13 @@ vi.mock(import("~/state/session"), async (original) => ({
22 readEnvironmentScope: () => true,
23 useEnvironmentScope: () => true,
24 }));
25 +vi.mock(import("~/hooks/useSettings"), async (original) => ({
26 + ...(await original()),
27 + useClientSettings: ((select?: (settings: ClientSettings) => unknown) => {
28 + const settings = { ...DEFAULT_CLIENT_SETTINGS, timestampFormat: state.timestampFormat };
29 + return select ? select(settings) : settings;
30 + }) as never,
31 +}));
32 vi.mock(import("~/state/pullRequests"), async (original) => {
33 const actual = await original();
34 const { Atom } = await import("effect/reactivity");
@@ -35,6 +50,7 @@ function setup() {
50 state.update.mockReset();
51 state.update.mockResolvedValue({ _tag: "Success", value: undefined });
52 state.canUpdate = true;
53 + state.timestampFormat = "locale";
54 }
55
56 import { act, render as renderUi } from "../../../test/render";
@@ -231,3 +247,26 @@ it("fixes an overview thread as its opening remark, since it has no line to atta
247 await userEvent.click(screen.getByRole("button", { name: "Fix in a thread" }));
248 expect(onFixFinding).toHaveBeenCalledWith({ kind: "comment", comment: remark });
249 });
250 +
251 +it("shows a comment's exact time in the chosen 24-hour clock", async () => {
252 + setup();
253 + state.timestampFormat = "24-hour";
254 + const createdAt = "2026-09-01T17:30:00Z";
255 + const comment = {
256 + id: "10",
257 + kind: "review-comment" as const,
258 + body: "A remark",
259 + author: { login: "reviewer", name: null, avatarUrl: null },
260 + createdAt,
261 + url: null,
262 + path: null,
263 + reviewState: null,
264 + };
265 + await using screen = await render({ ...detail, comments: [comment], commentCount: 1 });
266 +
267 + await userEvent.hover(screen.container.querySelector(`time[datetime="${createdAt}"]`)!);
268 + const expected = new Date(createdAt).toLocaleString(undefined, { hour12: false });
269 + await vi.waitFor(() =>
270 + expect(document.querySelector('[data-slot="tooltip-popup"]')?.textContent).toBe(expected),
271 + );
272 +});
apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx
+4 -1
@@ -34,6 +34,8 @@ import { useLocalStorage } from "~/hooks/useLocalStorage";
34 import { cn } from "~/lib/utils";
35 import { useOpenLink } from "~/browser/useOpenLink";
36 import { RelativeTime } from "~/components/RelativeTime";
37 +import { useClientSettings } from "~/hooks/useSettings";
38 +import { formatFullTimestamp } from "~/timestampFormat";
39
40 import { Button } from "../ui/button";
41 import { PullRequestEditButton } from "./PullRequestEditButton";
@@ -110,6 +112,7 @@ function CommentIdentity({
112 comment: PullRequestComment;
113 detail: PullRequestDetailView;
114 }) {
115 + const timestampFormat = useClientSettings((settings) => settings.timestampFormat);
116 const actor = comment.author;
117 const profileUrl = actor
118 ? sourceControlClients.get(detail.provider).authorProfileUrl(actor.login, detail.url)
@@ -137,7 +140,7 @@ function CommentIdentity({
140 </time>
141 </TooltipTrigger>
142 <TooltipPopup>
140 - {new Date(comment.createdAt).toLocaleString()}
143 + {formatFullTimestamp(comment.createdAt, timestampFormat)}
144 {comment.url ? " · Open comment on host" : ""}
145 </TooltipPopup>
146 </Tooltip>
apps/web/src/timestampFormat.ts
+7
@@ -131,6 +131,13 @@ export function formatChatTimestampTooltip(
131 return `${time}, ${day}${ordinalSuffix(day)} ${month} ${year}`;
132 }
133
134 +export function formatFullTimestamp(isoDate: string, timestampFormat: TimestampFormat): string {
135 + return new Date(isoDate).toLocaleString(
136 + undefined,
137 + timestampFormat === "locale" ? undefined : { hour12: timestampFormat === "12-hour" },
138 + );
139 +}
140 +
141 export function formatShortTimestamp(isoDate: string, timestampFormat: TimestampFormat): string {
142 const date = parseTimestampDate(isoDate);
143 if (!date) return "";