Problem
Two sidebar files render thread "updated at" timestamps with byte-identical inline date-fns calls:
surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx:393
{format(new Date(thread.updatedAt), "MMM d, yyyy 'at' h:mm a")}
surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx:392
{format(new Date(thread.updatedAt), "MMM d, yyyy 'at' h:mm a")}
Meanwhile, the rest of the app uses formatRelativeDate(iso) from surfsense_web/lib/format-date.ts for similar "recent timestamp" needs (e.g. action logs, team page). "How we display a recent timestamp" has two adapters in the codebase, with two different policies (relative vs absolute calendar).
If we ever want to switch threads to relative time, or i18n-localize the format, the two sidebars must be edited in lockstep.
Files
surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx (line 393)
surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx (line 392)
surfsense_web/lib/format-date.ts (new helper goes here)
What to do
-
Add a small helper in surfsense_web/lib/format-date.ts:
/**
* Format a thread's last-updated timestamp for the chats sidebars.
* Example: "Mar 23, 2026 at 4:30 PM"
*/
export function formatThreadTimestamp(dateString: string): string {
return format(new Date(dateString), "MMM d, yyyy 'at' h:mm a");
}
-
Replace both inline calls:
- {format(new Date(thread.updatedAt), "MMM d, yyyy 'at' h:mm a")}
+ {formatThreadTimestamp(thread.updatedAt)}
-
Drop the now-unused format import from date-fns in those two sidebars (if format isn't used elsewhere in the file).
Why this matters
- Locality of date-formatting policy: when we want "relative under 1 day, absolute beyond," or i18n localization, there's one place to edit.
- Tiny test surface: one helper unit-test instead of two component tests for the formatter.
- Aligns with the existing
formatRelativeDate pattern in format-date.ts.
Acceptance criteria
Difficulty
Good first issue — trivial DRY extraction.
Problem
Two sidebar files render thread "updated at" timestamps with byte-identical inline
date-fnscalls:surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx:393surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx:392Meanwhile, the rest of the app uses
formatRelativeDate(iso)fromsurfsense_web/lib/format-date.tsfor similar "recent timestamp" needs (e.g. action logs, team page). "How we display a recent timestamp" has two adapters in the codebase, with two different policies (relative vs absolute calendar).If we ever want to switch threads to relative time, or i18n-localize the format, the two sidebars must be edited in lockstep.
Files
surfsense_web/components/layout/ui/sidebar/AllPrivateChatsSidebar.tsx(line 393)surfsense_web/components/layout/ui/sidebar/AllSharedChatsSidebar.tsx(line 392)surfsense_web/lib/format-date.ts(new helper goes here)What to do
Add a small helper in
surfsense_web/lib/format-date.ts:Replace both inline calls:
Drop the now-unused
formatimport fromdate-fnsin those two sidebars (ifformatisn't used elsewhere in the file).Why this matters
formatRelativeDatepattern informat-date.ts.Acceptance criteria
formatThreadTimestampexported fromlib/format-date.tsDifficulty
Good first issue — trivial DRY extraction.