Skip to content

Commit

Permalink
create component for formatting dates
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Williams committed Aug 15, 2023
1 parent 78c9609 commit 552bf5f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/components/FormattedDate.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
import type { HTMLAttributes } from "astro/types";
import { getFormattedDate } from "@/utils";
interface Props {
date: Date;
className?: HTMLAttributes<"time">["class"];
}
const { date, className = null } = Astro.props;
const postDate = getFormattedDate(date, { month: "long" });
---

<time class={className} datetime={date.toISOString()}>
{postDate}
</time>

0 comments on commit 552bf5f

Please sign in to comment.