0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-10 22:38:53 -05:00
astro/examples/starlog/src/components/FormattedDate.astro
2023-12-28 21:10:08 +00:00

25 lines
367 B
Text

---
import type { HTMLAttributes } from 'astro/types';
type Props = HTMLAttributes<'time'> & {
date: Date;
};
const { date, ...attrs } = Astro.props;
---
<time datetime={date.toISOString()} {...attrs}>
{
date.toLocaleDateString('en-us', {
year: 'numeric',
month: 'short',
day: 'numeric',
})
}
</time>
<style>
time {
display: block;
}
</style>