manifold/web/components/relative-timestamp.tsx
Marshall Polaris 96a378ec4b
Make RelativeTimestamp a little more efficient (#754)
* Don't do extra dayjs work in timestamp components

* Remove extra wrapper from `RelativeTimestamp`
2022-08-12 17:48:41 -07:00

17 lines
397 B
TypeScript

import { DateTimeTooltip } from './datetime-tooltip'
import dayjs from 'dayjs'
import React from 'react'
export function RelativeTimestamp(props: { time: number }) {
const { time } = props
const dayJsTime = dayjs(time)
return (
<DateTimeTooltip
className="ml-1 whitespace-nowrap text-gray-400"
time={dayJsTime}
>
{dayJsTime.fromNow()}
</DateTimeTooltip>
)
}