File size: 347 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import { parseISO, format } from "date-fns";
type DateFormatterProps = { dateString: string | null };
export default function DateFormatter({ dateString }: DateFormatterProps) {
if (dateString === null) {
return <></>;
}
const date = parseISO(dateString);
return <time dateTime={dateString}>{format(date, "LLLL d, yyyy")}</time>;
}
|