mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-01 07:37:55 -05:00
Move app to apps/web-react in pnpm workspace layout
This commit is contained in:
24
apps/web-react/app/components/RelativeTime.tsx
Normal file
24
apps/web-react/app/components/RelativeTime.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
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(new Date(timestamp)) ?? undefined}>
|
||||
{children}
|
||||
</abbr>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user