Skip to content

Commit d9e874b

Browse files
committed
Issue 32: Add ISO8601 timestamp to date display title attribute
Add ISO8601 (UTC) formatted timestamp as a native browser tooltip on all date displays. This allows users to easily copy the exact timestamp while still seeing human-readable relative times and formatted dates in the custom tooltip. Fixes #32
1 parent 06acea2 commit d9e874b

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

packages/web/src/app/[domain]/components/DisplayDate.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
import { getFormattedDate } from "@/lib/utils"
22
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
33

4-
const formatFullDate = (date: Date) => {
5-
return new Intl.DateTimeFormat("en-US", {
6-
month: "long",
7-
day: "numeric",
8-
year: "numeric",
9-
hour: "numeric",
10-
minute: "2-digit",
11-
second: "2-digit",
12-
timeZoneName: "short",
13-
}).format(date)
14-
}
15-
164
interface DisplayDateProps {
175
date: Date
186
className?: string
197
}
208

219
export const DisplayDate = ({ date, className }: DisplayDateProps) => {
10+
// Format date in ISO8601 (UTC) format
11+
const iso8601Date = date.toISOString()
12+
2213
return (
2314
<TooltipProvider>
2415
<Tooltip>
@@ -28,7 +19,7 @@ export const DisplayDate = ({ date, className }: DisplayDateProps) => {
2819
</span>
2920
</TooltipTrigger>
3021
<TooltipContent>
31-
<p>{formatFullDate(date)}</p>
22+
<p>{iso8601Date}</p>
3223
</TooltipContent>
3324
</Tooltip>
3425
</TooltipProvider>

0 commit comments

Comments
 (0)