fp/packages/next/app/components/localized-date.tsx

15 lines
361 B
TypeScript

import { formatISO } from "date-fns";
interface ILocalizedDateProps {
date: Date;
}
export function LocalizedDate ({ date }: ILocalizedDateProps) {
const isoDateTime = formatISO(date);
const isoDate = formatISO(date, { representation: 'date' });
return (
<>
<time dateTime={isoDateTime}>{isoDate}</time>
</>
)
}