blob: fd9f7a6c4bd97bddb4378de41330022632d97f60 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
---
interface Props {
date: Date | string | number;
}
const { date } = Astro.props;
const formattedDate = date instanceof Date ? date : new Date(date);
---
<time datetime={formattedDate.toISOString()}>
{
formattedDate.toLocaleDateString('en-us', {
year: 'numeric',
month: 'short',
day: 'numeric',
})
}
</time>
|