Skip to content

Commit

Permalink
change date
Browse files Browse the repository at this point in the history
  • Loading branch information
halsk committed Dec 16, 2023
1 parent dae2c05 commit bec29ee
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/layouts/components/FormattedDate.astro
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
interface Props {
date: Date;
date: Date;
enableTime?: boolean;
}
const { date, enableTime } = Astro.props;
console.log(date);
---

<time datetime={date.toISOString()}>
{
date.toLocaleDateString('ja-JP', {
year: 'numeric',
month: 'short',
day: 'numeric',
hour: enableTime ? 'numeric' : undefined,
minute: enableTime ? 'numeric' : undefined,
})
}
</time>
{
date.toLocaleDateString("ja-JP", {
year: "numeric",
month: "short",
day: "numeric",
hour: enableTime ? "numeric" : undefined,
minute: enableTime ? "numeric" : undefined,
})
}
</time>

0 comments on commit bec29ee

Please sign in to comment.