From bd5f0dde00080d75d46904e8cabca6c77dd089e5 Mon Sep 17 00:00:00 2001 From: Chris Williams Date: Wed, 16 Aug 2023 13:59:55 +0100 Subject: [PATCH] update api, add passing format options --- src/components/FormattedDate.astro | 12 ++++++------ src/components/blog/PostPreview.astro | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/FormattedDate.astro b/src/components/FormattedDate.astro index c15a5ac..1878421 100644 --- a/src/components/FormattedDate.astro +++ b/src/components/FormattedDate.astro @@ -2,16 +2,16 @@ import type { HTMLAttributes } from "astro/types"; import { getFormattedDate } from "@/utils"; -interface Props { +type Props = HTMLAttributes<"time"> & { date: Date; - className?: HTMLAttributes<"time">["class"]; -} + dateTimeOptions?: Intl.DateTimeFormatOptions; +}; -const { date, className = null } = Astro.props; +const { date, dateTimeOptions, ...attrs } = Astro.props; -const postDate = getFormattedDate(date, { month: "long" }); +const postDate = getFormattedDate(date, dateTimeOptions); --- -