import { DateTimeTooltip } from './datetime-tooltip' import React, { useEffect, useState } from 'react' import { fromNow } from 'web/lib/util/time' export function RelativeTimestamp(props: { time: number }) { const { time } = props const [isClient, setIsClient] = useState(false) useEffect(() => { // Only render on client to prevent difference from server. setIsClient(true) }, []) return ( {isClient ? fromNow(time) : ''} ) }