react-components/blog/date-formatter.tsx

13 lines
285 B
TypeScript
Raw Normal View History

2024-10-30 18:28:41 +01:00
import { parseISO, format } from "date-fns";
type Props = {
dateString: string;
};
const DateFormatter = ({ dateString }: Props) => {
const date = parseISO(dateString);
return <time dateTime={dateString}>{format(date, "LLLL d, yyyy")}</time>;
};
export default DateFormatter;