blob: 13d531dd7c784b59092deb55587305e479fc19cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
---
import type { HTMLAttributes } from "astro/types";
import { getRelativeTimeUnit } from "@utils/datetime";
interface Props {
date: Date;
locales: Intl.LocalesArgument;
options: Intl.RelativeTimeFormatOptions;
itemprop: HTMLAttributes<"time">["itemprop"];
}
const { date, locales, options } = Astro.props;
const format = new Intl.RelativeTimeFormat(locales, options).format(
...getRelativeTimeUnit(date),
);
---
{format}
|