feat(shared): extract formatThreadTimestamp helper for chats sidebars (fixes #1376)

- Add formatThreadTimestamp() to surfsense_web/lib/format-date.ts
- Use shared helper in AllPrivateChatsSidebar and AllSharedChatsSidebar
- Remove unused date-fns format import from both sidebar files
- Centralises timestamp formatting policy for future i18n/relative-time changes
This commit is contained in:
guangyang1206 2026-05-10 12:05:10 +08:00
parent 83ee58016e
commit 10212f3d5a
3 changed files with 12 additions and 4 deletions

View file

@ -22,3 +22,11 @@ export function formatRelativeDate(dateString: string): string {
if (daysAgo < 7) return `${daysAgo}d ago`;
return format(date, "MMM d, yyyy");
}
/**
* 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");
}