diff --git a/ui/src/components/IssueChatThread.tsx b/ui/src/components/IssueChatThread.tsx index bfb86e4b..38a6104b 100644 --- a/ui/src/components/IssueChatThread.tsx +++ b/ui/src/components/IssueChatThread.tsx @@ -177,6 +177,15 @@ function parseReassignment(target: string): PaperclipIssueRuntimeReassignment | return null; } +const WEEK_MS = 7 * 24 * 60 * 60 * 1000; + +function commentDateLabel(date: Date | string | undefined): string { + if (!date) return ""; + const then = new Date(date).getTime(); + if (Date.now() - then < WEEK_MS) return timeAgo(date); + return formatShortDate(date); +} + function IssueChatTextPart({ text }: { text: string }) { return {text}; } @@ -471,7 +480,7 @@ function IssueChatUserMessage() { href={anchorId ? `#${anchorId}` : undefined} className="text-[11px] text-muted-foreground hover:text-foreground hover:underline" > - {message.createdAt ? formatShortDate(message.createdAt) : ""} + {message.createdAt ? commentDateLabel(message.createdAt) : ""} @@ -595,12 +604,6 @@ function IssueChatAssistantMessage() {
- - {message.createdAt ? formatShortDate(message.createdAt) : ""} - ) : null} + + + + {message.createdAt ? commentDateLabel(message.createdAt) : ""} + + + + {message.createdAt ? formatDateTime(message.createdAt) : ""} + +