Add hour and minute to comment timestamps on issue pages
Comments now show localized date+time (e.g. "Feb 20, 2026, 2:15 PM") instead of just the date. Added formatDateTime utility to keep the existing date-only formatDate unchanged for other contexts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,16 @@ export function formatDate(date: Date | string): string {
|
||||
});
|
||||
}
|
||||
|
||||
export function formatDateTime(date: Date | string): string {
|
||||
return new Date(date).toLocaleString("en-US", {
|
||||
month: "short",
|
||||
day: "numeric",
|
||||
year: "numeric",
|
||||
hour: "numeric",
|
||||
minute: "2-digit",
|
||||
});
|
||||
}
|
||||
|
||||
export function relativeTime(date: Date | string): string {
|
||||
const now = Date.now();
|
||||
const then = new Date(date).getTime();
|
||||
|
||||
Reference in New Issue
Block a user