File size: 414 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { asDate } from "@prismicio/helpers";
import { DateField } from "@prismicio/types";

const formatter = new Intl.DateTimeFormat("en-US", {
  month: "long",
  day: "numeric",
  year: "numeric",
});

type DateProps = {
  dateField: DateField;
};

export default function Date({ dateField }: DateProps) {
  const date = asDate(dateField);

  return <time dateTime={dateField}>{formatter.format(date)}</time>;
}