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

15 lines
361 B
TypeScript
Raw Normal View History

2024-01-20 16:16:14 +00:00
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>
</>
)
}