feat(frontend): show precise date on hover over relative timestamps

This commit is contained in:
2026-05-15 03:19:24 +02:00
parent e6b351b472
commit 9976c1481a

View File

@@ -8,7 +8,7 @@ import {
} from "@/components/ui/card"; } from "@/components/ui/card";
import { UserAvatar } from "./user-avatar"; import { UserAvatar } from "./user-avatar";
import { deleteThought, Me, Thought } from "@/lib/api"; import { deleteThought, Me, Thought } from "@/lib/api";
import { formatDistanceToNow } from "date-fns"; import { format, formatDistanceToNow } from "date-fns";
import { useAuth } from "@/hooks/use-auth"; import { useAuth } from "@/hooks/use-auth";
import { useState } from "react"; import { useState } from "react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
@@ -121,9 +121,13 @@ export function ThoughtCard({
<span className="font-bold"> <span className="font-bold">
{author.displayName || author.username} {author.displayName || author.username}
</span> </span>
<span className="text-sm text-muted-foreground text-shadow-sm"> <time
dateTime={new Date(thought.createdAt).toISOString()}
title={format(new Date(thought.createdAt), "PPP p")}
className="text-sm text-muted-foreground text-shadow-sm"
>
{timeAgo} {timeAgo}
</span> </time>
</div> </div>
</Link> </Link>
<DropdownMenu> <DropdownMenu>