mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-18 23:11:12 +02:00
feat(chat): add shared formatMessageTimestamp helper
This commit is contained in:
parent
f0cd20bcbd
commit
f4870ad1c2
1 changed files with 14 additions and 0 deletions
|
|
@ -68,3 +68,17 @@ export function formatRelativeFutureDate(dateString: string): string {
|
||||||
export function formatThreadTimestamp(dateString: string): string {
|
export function formatThreadTimestamp(dateString: string): string {
|
||||||
return format(new Date(dateString), "MMM d, yyyy 'at' h:mm a");
|
return format(new Date(dateString), "MMM d, yyyy 'at' h:mm a");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Format a chat message timestamp for inline display under a bubble.
|
||||||
|
* Locale-aware, 12-hour clock. Example: "Jul 13, 10:42 PM".
|
||||||
|
*/
|
||||||
|
export function formatMessageTimestamp(date: Date): string {
|
||||||
|
return date.toLocaleDateString(undefined, {
|
||||||
|
month: "short",
|
||||||
|
day: "numeric",
|
||||||
|
hour: "numeric",
|
||||||
|
minute: "2-digit",
|
||||||
|
hour12: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue