1import { useRelativeTimeState } from "../hooks/useRelativeTimeState";
2
3// Use a live clock because the compiler caches inline formatting on the timestamp.
4export function RelativeTime(props: { timestamp: string }) {
5 const relative = useRelativeTimeState(props.timestamp);
6 if (relative.status !== "relative") return null;
7 return relative.suffix ? `${relative.value} ${relative.suffix}` : relative.value;
8}