summaryrefslogtreecommitdiff
path: root/website/src/components/FormattedDate.astro
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2026-04-25 13:06:00 +0100
committerJoe Carstairs <me@joeac.net>2026-04-25 13:06:00 +0100
commit5a56c572af762efb56780b48cf003bb0fbcc23b9 (patch)
tree37933d63c738c4c543df86466123ce07ddba76d5 /website/src/components/FormattedDate.astro
parentac8011ddb1f5f6c0f54fbb877ed11725e6b4490a (diff)
FormattedDate component can be hidden
Diffstat (limited to 'website/src/components/FormattedDate.astro')
-rw-r--r--website/src/components/FormattedDate.astro20
1 files changed, 11 insertions, 9 deletions
diff --git a/website/src/components/FormattedDate.astro b/website/src/components/FormattedDate.astro
index bb7a2c0..ce700f1 100644
--- a/website/src/components/FormattedDate.astro
+++ b/website/src/components/FormattedDate.astro
@@ -2,20 +2,22 @@
interface Props {
className?: string;
date: Date | string;
+ hidden?: boolean;
}
-let { className, date } = Astro.props;
+let { className, date, hidden } = Astro.props;
if (typeof(date) === 'string') {
date = new Date(date);
}
----
-
-<time datetime={date.toISOString()} class={className ?? ''}>
- {
- date.toLocaleDateString('en-GB', {
+const dateStr =
+ date.toLocaleDateString('en-GB', {
year: 'numeric',
month: 'long',
day: 'numeric',
- })
- }
-</time>
+ });
+---
+
+{ hidden
+ ? <time datetime={date.toISOString()} class={className ?? ''} hidden>{dateStr}</time>
+ : <time datetime={date.toISOString()} class={className ?? ''}>{dateStr}</time>
+}