The best way to control Claude Code, Codex and more from any computer or phone
fix(mobile): honor Android clock format in message timestamps (#33078)
Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Kolja committed
Nov 15, 2026 at 07:14 UTC
7ced2ca6ccce1b691d9fe4605f534c7b0bac1753
5 files changed
+59
-5
apps/mobile/src/features/threads/ThreadFeed.tsx
+6
-2
@@ -288,7 +288,7 @@ import {
288
import { ZoomableImagePressable } from "./ZoomableImagePressable";
289
import { openSettings } from "../settings/settings-navigation";
290
import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
291
-import { formatMessageTimestamp } from "./messageTimestamp";
291
+import { useMessageTimeFormatter } from "./useMessageTimeFormatter";
292
293
const WIDE_MARKDOWN_BLOCK_OPTIONS = {
294
// iOS blockquotes and selectable text measure separately; definite bubble width matches UIKit's drawing width.
@@ -1667,6 +1667,7 @@ function renderFeedEntry(
1667
| "threadId"
1668
| "workspaceRoot"
1669
> & {
1670
+ readonly formatMessageTime: (input: string) => string;
1671
readonly copiedRowId: string | null;
1672
readonly expandedWorkRows: Record<string, boolean>;
1673
readonly workRowSizing: ReturnType<typeof deriveThreadWorkLogSizing>;
@@ -1912,7 +1913,7 @@ function renderFeedEntry(
1913
const presentation = resolveUserMessagePresentation(message);
1914
const renderedText = renderAssistantCitationsAsText(presentation.text);
1915
const styles = isUser ? markdownStyles.user : markdownStyles.assistant;
1915
- const timestampLabel = formatMessageTimestamp(isUser ? message.createdAt : message.updatedAt);
1916
+ const timestampLabel = props.formatMessageTime(isUser ? message.createdAt : message.updatedAt);
1917
const attachments = message.attachments ?? [];
1918
const hasReviewCommentContext = presentation.text.includes("<review_comment");
1919
// Android does not reposition children after maxWidth clamps bubbles; definite width prevents wide-block overlap.
@@ -2740,6 +2741,7 @@ const THREAD_FEED_MAINTAIN_SCROLL_AT_END = {
2741
} as const;
2742
2743
export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
2744
+ const formatMessageTime = useMessageTimeFormatter();
2745
const { listRef, onIsAtEndChange, onHeaderMaterialVisibilityChange } = props;
2746
const workflowOpening = useWorkflowOpening(props.detailRef);
2747
const guestShare = useThreadGuestShare(props.detailRef);
@@ -3341,6 +3343,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
3343
const listAppearanceData = {
3344
disclosureLayout,
3345
reduceMotion,
3346
+ formatMessageTime,
3347
worktreeSetup: props.worktreeSetup,
3348
setupWorkingStartedAt: props.setupWorkingStartedAt,
3349
dispatchingMessageId: props.dispatchingMessageId,
@@ -3751,6 +3754,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
3754
) : null}
3755
{renderFeedEntry(info, {
3756
userMessageGrouping: info.item.userMessageGrouping,
3757
+ formatMessageTime,
3758
environmentId: props.environmentId,
3759
dispatchingMessageId: props.dispatchingMessageId,
3760
onEditPendingMessage: props.onEditPendingMessage,
apps/mobile/src/features/threads/messageTimestamp.test.ts
+13
-1
@@ -1,6 +1,6 @@
1
import { describe, expect, it } from "vite-plus/test";
2
3
-import { formatMessageTimestamp } from "./messageTimestamp";
3
+import { createMessageTimeFormatter, formatMessageTimestamp } from "./messageTimestamp";
4
5
describe("formatMessageTimestamp", () => {
6
const now = new Date(2026, 10, 8, 20, 0).getTime();
@@ -20,3 +20,15 @@ describe("formatMessageTimestamp", () => {
20
);
21
});
22
});
23
+
24
+describe("createMessageTimeFormatter", () => {
25
+ const now = new Date(2026, 0, 1, 20, 0).getTime();
26
+
27
+ it("follows the system clock preference over the locale's hour cycle", () => {
28
+ const format24 = createMessageTimeFormatter(true, "en-US");
29
+ expect(format24(new Date(2026, 0, 1, 15, 7).toISOString(), now)).toBe("15:07");
30
+ expect(format24(new Date(2026, 0, 1, 0, 7).toISOString(), now)).toBe("00:07");
31
+ const format12 = createMessageTimeFormatter(false, "en-GB");
32
+ expect(format12(new Date(2026, 0, 1, 15, 7).toISOString(), now)).toMatch(/^3:07\spm$/i);
33
+ });
34
+});
apps/mobile/src/features/threads/messageTimestamp.ts
+17
-2
@@ -7,13 +7,28 @@ const DATE_WITH_YEAR_FORMATTER = new Intl.DateTimeFormat(undefined, {
7
});
8
9
/** Time only for today's messages; older ones lead with the day and month. */
10
-export function formatMessageTimestamp(input: string, nowMs: number = Date.now()): string {
10
+export function formatMessageTimestamp(
11
+ input: string,
12
+ nowMs: number = Date.now(),
13
+ timeFormatter: Intl.DateTimeFormat = TIME_FORMATTER,
14
+): string {
15
const timestamp = Date.parse(input);
16
if (Number.isNaN(timestamp)) return "";
17
const date = new Date(timestamp);
18
const now = new Date(nowMs);
15
- const time = TIME_FORMATTER.format(date);
19
+ const time = timeFormatter.format(date);
20
if (date.toDateString() === now.toDateString()) return time;
21
const sameYear = date.getFullYear() === now.getFullYear();
22
return `${(sameYear ? DATE_FORMATTER : DATE_WITH_YEAR_FORMATTER).format(date)} ${time}`;
23
}
24
+
25
+/** `is24Hour` overrides the locale's hour cycle with the system clock preference when known. */
26
+export function createMessageTimeFormatter(is24Hour: boolean | undefined, locale?: string) {
27
+ const timeFormatter = new Intl.DateTimeFormat(locale, {
28
+ hour: "numeric",
29
+ minute: "2-digit",
30
+ ...(is24Hour === undefined ? {} : { hourCycle: is24Hour ? "h23" : "h12" }),
31
+ });
32
+ return (input: string, nowMs?: number): string =>
33
+ formatMessageTimestamp(input, nowMs, timeFormatter);
34
+}
apps/mobile/src/features/threads/useMessageTimeFormatter.ts
new
+22
@@ -0,0 +1,22 @@
1
+import { requireNativeModule } from "expo";
2
+import { useEffect, useMemo, useState } from "react";
3
+import { AppState, Platform } from "react-native";
4
+import { createMessageTimeFormatter } from "./messageTimestamp";
5
+
6
+function systemUses24HourClock() {
7
+ if (Platform.OS !== "android") return undefined;
8
+ return requireNativeModule<{ is24HourFormat(): boolean }>("T3NativeControls").is24HourFormat();
9
+}
10
+
11
+export function useMessageTimeFormatter() {
12
+ const [is24Hour, setIs24Hour] = useState(systemUses24HourClock);
13
+ // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- Refresh the native clock preference when Android returns to the foreground.
14
+ useEffect(() => {
15
+ if (Platform.OS !== "android") return;
16
+ const subscription = AppState.addEventListener("change", (state) => {
17
+ if (state === "active") setIs24Hour(systemUses24HourClock());
18
+ });
19
+ return () => subscription.remove();
20
+ }, []);
21
+ return useMemo(() => createMessageTimeFormatter(is24Hour), [is24Hour]);
22
+}
apps/mobile/src/lib/filePreview.test.ts
+1
@@ -113,6 +113,7 @@ vi.mock("../components/ui/Button", () => ({
113
createElement("button", { onClick: props.onPress, disabled: props.disabled }, props.label),
114
}));
115
vi.mock("expo", () => ({
116
+ requireNativeModule: () => ({ is24HourFormat: () => true }),
117
useEvent: (_player: unknown, _event: unknown, initial: unknown) => initial,
118
useReleasingSharedObjectWithLifecycle: (
119
lifecycle: {