mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-16 16:09:09 -05:00
23 lines
461 B
TypeScript
23 lines
461 B
TypeScript
import type * as React from "react";
|
|
import { useDateTimeFormat } from "~/hooks/intl/useDateTimeFormat";
|
|
|
|
export function RelativeTime({
|
|
children,
|
|
timestamp,
|
|
}: {
|
|
children: React.ReactNode;
|
|
timestamp: number;
|
|
}) {
|
|
const { formatter } = useDateTimeFormat({
|
|
hour: "numeric",
|
|
minute: "numeric",
|
|
day: "numeric",
|
|
month: "numeric",
|
|
timeZoneName: "short",
|
|
});
|
|
|
|
return (
|
|
<abbr title={formatter.format(timestamp) ?? undefined}>{children}</abbr>
|
|
);
|
|
}
|