mirror of
https://github.com/withastro/astro.git
synced 2025-02-10 22:38:53 -05:00
25 lines
367 B
Text
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>
|