add tooltips to all relative dates with exact time

This commit is contained in:
Athou
2023-06-17 22:51:18 +02:00
parent 8325236d0e
commit 78c8711a79

View File

@@ -1,4 +1,5 @@
import { Trans } from "@lingui/macro"
import { Tooltip } from "@mantine/core"
import dayjs from "dayjs"
import { useEffect, useState } from "react"
@@ -10,5 +11,10 @@ export function RelativeDate(props: { date: Date | number | undefined }) {
}, [])
if (!props.date) return <Trans>N/A</Trans>
return <>{dayjs(props.date).from(dayjs(now))}</>
const date = dayjs(props.date)
return (
<Tooltip label={date.toString()} openDelay={500}>
<span>{date.from(dayjs(now))}</span>
</Tooltip>
)
}