diff options
| author | Joe Carstairs <me@joeac.net> | 2026-04-25 13:06:00 +0100 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2026-04-25 13:06:00 +0100 |
| commit | 5a56c572af762efb56780b48cf003bb0fbcc23b9 (patch) | |
| tree | 37933d63c738c4c543df86466123ce07ddba76d5 /website | |
| parent | ac8011ddb1f5f6c0f54fbb877ed11725e6b4490a (diff) | |
FormattedDate component can be hidden
Diffstat (limited to 'website')
| -rw-r--r-- | website/src/components/FormattedDate.astro | 20 |
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> +} |
