shellphone.app/app/blog/components/date.tsx

11 lines
274 B
TypeScript
Raw Normal View History

2021-08-27 16:08:38 +00:00
const formatter = Intl.DateTimeFormat("en-US", {
day: "2-digit",
month: "short",
year: "numeric",
});
export default function DateComponent({ dateString }: any) {
const date = new Date(dateString);
return <time dateTime={dateString}>{formatter.format(date)}</time>;
}