mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-19 18:45:15 +02:00
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:
parent
83ee58016e
commit
10212f3d5a
3 changed files with 12 additions and 4 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue