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:
@@ -5,7 +5,7 @@ import type { IssueComment, Agent } from "@paperclip/shared";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Identity } from "./Identity";
|
||||
import { MarkdownEditor, type MarkdownEditorRef, type MentionOption } from "./MarkdownEditor";
|
||||
import { formatDate } from "../lib/utils";
|
||||
import { formatDateTime } from "../lib/utils";
|
||||
|
||||
interface CommentWithRunMeta extends IssueComment {
|
||||
runId?: string | null;
|
||||
@@ -79,7 +79,7 @@ export function CommentThread({ comments, onAdd, issueStatus, agentMap }: Commen
|
||||
size="sm"
|
||||
/>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{formatDate(comment.createdAt)}
|
||||
{formatDateTime(comment.createdAt)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-sm prose prose-sm prose-invert max-w-none prose-p:my-1 prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-pre:my-2 prose-headings:my-2 prose-headings:text-sm">
|
||||
|
||||
@@ -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