15 lines
361 B
TypeScript
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>
|
|
</>
|
|
)
|
|
} |