diff --git a/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx b/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx index fea07562..33e771f0 100644 --- a/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx +++ b/app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx @@ -119,10 +119,17 @@ const Comment = (props: { }) => { const did = props.comment.bsky_profiles?.did; + let timeAgoDate = timeAgo(props.record.createdAt); + const formattedDate = useLocalizedDate(props.record.createdAt, { + year: "numeric", + month: "long", + day: "2-digit", + }); + return (
- {did && ( + {did ? ( } /> - )} + ) : null} +
{timeAgoDate}
{props.record.attachment && PubLeafletComment.isLinearDocumentQuote(props.record.attachment) && ( diff --git a/src/utils/timeAgo.ts b/src/utils/timeAgo.ts index bed5d22b..0a59025d 100644 --- a/src/utils/timeAgo.ts +++ b/src/utils/timeAgo.ts @@ -6,10 +6,16 @@ export function timeAgo(timestamp: string): string { const diffMinutes = Math.floor(diffSeconds / 60); const diffHours = Math.floor(diffMinutes / 60); const diffDays = Math.floor(diffHours / 24); + const diffWeeks = Math.floor(diffDays / 7); + const diffMonths = Math.floor(diffDays / 30); const diffYears = Math.floor(diffDays / 365); if (diffYears > 0) { return `${diffYears} year${diffYears === 1 ? "" : "s"} ago`; + } else if (diffMonths > 0) { + return `${diffMonths} month${diffMonths === 1 ? "" : "s"} ago`; + } else if (diffWeeks > 0) { + return `${diffWeeks} week${diffWeeks === 1 ? "" : "s"} ago`; } else if (diffDays > 0) { return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`; } else if (diffHours > 0) {