2022-05-05 22:30:30 +00:00
|
|
|
import { DateTimeTooltip } from './datetime-tooltip'
|
2022-08-13 00:48:41 +00:00
|
|
|
import dayjs from 'dayjs'
|
2022-05-05 22:30:30 +00:00
|
|
|
import React from 'react'
|
|
|
|
|
|
|
|
export function RelativeTimestamp(props: { time: number }) {
|
|
|
|
const { time } = props
|
2022-08-13 00:48:41 +00:00
|
|
|
const dayJsTime = dayjs(time)
|
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"
|
|
|
|
time={dayJsTime}
|
|
|
|
>
|
|
|
|
{dayJsTime.fromNow()}
|
2022-05-05 22:30:30 +00:00
|
|
|
</DateTimeTooltip>
|
|
|
|
)
|
|
|
|
}
|