blob: aba7f4d2d843a2af6ab64ac2992d6d1b3f3bcf88 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
---
import { getFormattedDate } from "@/utils/date";
import type { HTMLAttributes } from "astro/types";
type Props = HTMLAttributes<"time"> & {
date: Date;
dateTimeOptions?: Intl.DateTimeFormatOptions;
};
const { date, dateTimeOptions, ...attrs } = Astro.props;
const postDate = getFormattedDate(date, dateTimeOptions);
const ISO = date.toISOString();
---
<time datetime={ISO} title={ISO} {...attrs}>{postDate}</time>
|