aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pages
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-11-05 14:24:06 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-11-05 14:24:06 +0900
commit0459cc71cd7081d03e51db10e6ae65cb73f9a4f2 (patch)
tree69fbdf1570a8b19a672e07343c481f52e0f1c1a6 /src/pages
parentfd377d1df26df4643f8028677b027327d397f121 (diff)
events: アーカイブの説明文を期間に合わせて出し分け
過去の月にも未来の月にも「開催日が過ぎたものも掲載」と書いていた。 すべて過去・今日を含む・すべて未来の3通りに分け、descriptionも あわせて切り替える。
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/kodaira/events/[period].astro31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/pages/kodaira/events/[period].astro b/src/pages/kodaira/events/[period].astro
index 7ef4599..084760c 100644
--- a/src/pages/kodaira/events/[period].astro
+++ b/src/pages/kodaira/events/[period].astro
@@ -59,20 +59,41 @@ const eventRows =
const months = kind === 'fiscal' ? monthsInFiscalYear(key) : [];
const url = (period: string) => `${SCHEDULE_BASE_PATH}${period}/`;
+
+// 期間がすべて過去か、すべて未来か、今日を含むかで説明文を変える。
+// (過去の月に「今後の予定です」と書いたり、未来の月に「終了分も掲載」と書いたりしない)
+const pad = (n: number) => String(n).padStart(2, '0');
+const now = new Date();
+const currentMonth = `${now.getFullYear()}-${pad(now.getMonth() + 1)}`;
+const periodMonths = kind === 'fiscal' ? monthsInFiscalYear(key) : [key];
+const firstMonth = periodMonths[0] ?? key;
+const lastMonth = periodMonths[periodMonths.length - 1] ?? key;
+const isAllPast = lastMonth < currentMonth;
+const isAllFuture = firstMonth > currentMonth;
+
+const lead = isAllPast
+ ? `${label}の小平市のイベントと、審議会等・市議会の予定を、記録として掲載しています。`
+ : isAllFuture
+ ? `${label}の小平市のイベントと、審議会等・市議会の開催予定です。`
+ : `${label}の小平市のイベントと、審議会等・市議会の開催予定です。開催日が過ぎたものもあわせて掲載しています。`;
+const caution = isAllPast
+ ? '掲載内容は、掲載時点のものです。'
+ : '変更になることがありますので、各問い合わせ先へご確認ください。';
+
+const description = isAllPast
+ ? `${label}に開催された小平市のイベントと、審議会・市議会の予定の記録です。日程・会場を確認できます。`
+ : `${label}の小平市のイベントと、審議会・市議会の開催予定の一覧です。日程・会場・申込期限を確認できます。`;
---
<StarlightPage
frontmatter={{
title: `小平市のイベント・行事予定(${label})`,
- description: `${label}の小平市のイベントと、審議会・市議会の開催予定の一覧です。日程・会場・申込期限を確認できます。`,
+ description,
}}
>
<p><a href={SCHEDULE_BASE_PATH}>← 小平市のイベント・行事予定カレンダー(今後)に戻る</a></p>
- <p>
- {label}の小平市のイベントと、審議会等・市議会の開催予定です。開催日が過ぎたものも記録として掲載しています。
- 変更になることがありますので、各問い合わせ先へご確認ください。
- </p>
+ <p>{lead}{caution}</p>
{
kind === 'fiscal' && (