import { Trans } from "@lingui/macro" import { Tooltip } from "@mantine/core" import dayjs from "dayjs" import { useEffect, useState } from "react" export function RelativeDate(props: { date: Date | number | undefined }) { const [now, setNow] = useState(new Date()) useEffect(() => { const interval = setInterval(() => setNow(new Date()), 60 * 1000) return () => clearInterval(interval) }, []) if (!props.date) return N/A const date = dayjs(props.date) return ( {date.from(dayjs(now))} ) }