2022-05-05 22:30:30 +00:00
|
|
|
import { DateTimeTooltip } from './datetime-tooltip'
|
2022-08-31 20:35:34 +00:00
|
|
|
import { fromNow } from 'web/lib/util/time'
|
2022-10-12 21:07:07 +00:00
|
|
|
import { useIsClient } from 'web/hooks/use-is-client'
|
2022-05-05 22:30:30 +00:00
|
|
|
|
|
|
|
export function RelativeTimestamp(props: { time: number }) {
|
|
|
|
const { time } = props
|
2022-10-12 21:07:07 +00:00
|
|
|
const isClient = useIsClient()
|
2022-05-05 22:30:30 +00:00
|
|
|
return (
|
2022-08-13 00:48:41 +00:00
|
|
|
<DateTimeTooltip
|
|
|
|
className="ml-1 whitespace-nowrap text-gray-400"
|
2022-08-27 20:46:35 +00:00
|
|
|
time={time}
|
2022-08-13 00:48:41 +00:00
|
|
|
>
|
2022-10-12 21:07:07 +00:00
|
|
|
{isClient && fromNow(time)}
|
2022-05-05 22:30:30 +00:00
|
|
|
</DateTimeTooltip>
|
|
|
|
)
|
|
|
|
}
|