diff options
Diffstat (limited to 'examples/blog/src/components/FormattedDate.astro')
-rw-r--r-- | examples/blog/src/components/FormattedDate.astro | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/blog/src/components/FormattedDate.astro b/examples/blog/src/components/FormattedDate.astro new file mode 100644 index 000000000..1bcce73a2 --- /dev/null +++ b/examples/blog/src/components/FormattedDate.astro @@ -0,0 +1,17 @@ +--- +interface Props { + date: Date; +} + +const { date } = Astro.props; +--- + +<time datetime={date.toISOString()}> + { + date.toLocaleDateString('en-us', { + year: 'numeric', + month: 'short', + day: 'numeric', + }) + } +</time> |