@devries-cameron20 / t3code Mirror · read-only / commits / 1d5404ad5d
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 02:00 UTC

fix(mobile): older chat messages show the date, not just the time (#33189)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Nov 8, 2026 at 20:36 UTC 1d5404ad5d1ed12e6feb84773d3f0c6baf32056c
3 files changed +43 -13
apps/mobile/src/features/threads/ThreadFeed.tsx
+2 -13
@@ -287,6 +287,7 @@ import {
287 } from "./ThreadMarkdownImage";
288 import { openSettings } from "../settings/settings-navigation";
289 import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
290 +import { formatMessageTimestamp } from "./messageTimestamp";
291
292 const WIDE_MARKDOWN_BLOCK_OPTIONS = {
293 // iOS blockquotes and selectable text measure separately; definite bubble width matches UIKit's drawing width.
@@ -294,18 +295,6 @@ const WIDE_MARKDOWN_BLOCK_OPTIONS = {
295 includeOrderedLists: Platform.OS === "android",
296 } as const;
297
297 -const MESSAGE_TIME_FORMATTER = new Intl.DateTimeFormat(undefined, {
298 - hour: "numeric",
299 - minute: "2-digit",
300 -});
301 -function formatMessageTime(input: string): string {
302 - const timestamp = Date.parse(input);
303 - if (Number.isNaN(timestamp)) {
304 - return "";
305 - }
306 - return MESSAGE_TIME_FORMATTER.format(timestamp);
307 -}
308 -
298 const TURN_FOLD_HEIGHT = 42;
299 const FEED_PADDING_TOP = 12;
300 // Rows re-measure within a commit or two of a width change. LegendList also defers imperative
@@ -1873,7 +1862,7 @@ function renderFeedEntry(
1862 const presentation = resolveUserMessagePresentation(message);
1863 const renderedText = renderAssistantCitationsAsText(presentation.text);
1864 const styles = isUser ? markdownStyles.user : markdownStyles.assistant;
1876 - const timestampLabel = formatMessageTime(isUser ? message.createdAt : message.updatedAt);
1865 + const timestampLabel = formatMessageTimestamp(isUser ? message.createdAt : message.updatedAt);
1866 const attachments = message.attachments ?? [];
1867 const hasReviewCommentContext = presentation.text.includes("<review_comment");
1868 // Android does not reposition children after maxWidth clamps bubbles; definite width prevents wide-block overlap.
apps/mobile/src/features/threads/messageTimestamp.test.ts new
+22
@@ -0,0 +1,22 @@
1 +import { describe, expect, it } from "vite-plus/test";
2 +
3 +import { formatMessageTimestamp } from "./messageTimestamp";
4 +
5 +describe("formatMessageTimestamp", () => {
6 + const now = new Date(2026, 10, 8, 20, 0).getTime();
7 + const time = (date: Date) =>
8 + date.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" });
9 +
10 + it("shows only the time for today, and the day and month for any earlier day", () => {
11 + const today = new Date(2026, 10, 8, 0, 5);
12 + const yesterday = new Date(2026, 10, 7, 23, 55);
13 + const lastYear = new Date(2025, 10, 5, 19, 17);
14 + expect(formatMessageTimestamp(today.toISOString(), now)).toBe(time(today));
15 + expect(formatMessageTimestamp(yesterday.toISOString(), now)).toBe(
16 + `${yesterday.toLocaleDateString(undefined, { month: "numeric", day: "numeric" })} ${time(yesterday)}`,
17 + );
18 + expect(formatMessageTimestamp(lastYear.toISOString(), now)).toBe(
19 + `${lastYear.toLocaleDateString(undefined, { month: "numeric", day: "numeric", year: "numeric" })} ${time(lastYear)}`,
20 + );
21 + });
22 +});
apps/mobile/src/features/threads/messageTimestamp.ts new
+19
@@ -0,0 +1,19 @@
1 +const TIME_FORMATTER = new Intl.DateTimeFormat(undefined, { hour: "numeric", minute: "2-digit" });
2 +const DATE_FORMATTER = new Intl.DateTimeFormat(undefined, { month: "numeric", day: "numeric" });
3 +const DATE_WITH_YEAR_FORMATTER = new Intl.DateTimeFormat(undefined, {
4 + month: "numeric",
5 + day: "numeric",
6 + year: "numeric",
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 {
11 + const timestamp = Date.parse(input);
12 + if (Number.isNaN(timestamp)) return "";
13 + const date = new Date(timestamp);
14 + const now = new Date(nowMs);
15 + const time = TIME_FORMATTER.format(date);
16 + if (date.toDateString() === now.toDateString()) return time;
17 + const sameYear = date.getFullYear() === now.getFullYear();
18 + return `${(sameYear ? DATE_FORMATTER : DATE_WITH_YEAR_FORMATTER).format(date)} ${time}`;
19 +}