summaryrefslogtreecommitdiff
path: root/src/components/organisms/Date.astro
blob: 960cfb71d2b84d90cbfb72e0507d1a8b867bfcfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
import type { HTMLAttributes } from "astro/types";

interface Props {
  date: Date;
  locales: Intl.LocalesArgument;
  options: Intl.DateTimeFormatOptions;
  itemprop: HTMLAttributes<"time">["itemprop"];
}

const { date, locales, options } = Astro.props;

const datetime = date.toISOString();
const format = new Intl.DateTimeFormat(locales, options).format(date);
---

<time {datetime}>{format}</time>