From 4f7cb7d1fa13fc356813ed5fbb61bac72f327012 Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Fri, 20 Nov 2026 14:23:18 +0900 Subject: events.json: 市報こだいら11月20日号の催しを反映 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 公民館講座・健診・障害者週間・工事説明会・自治会懇談会など24件を追加 - パブコメ2件(アクティブプラン21・多文化共生)を追加し、第五期地域福祉計画の電話を修正 - 鷹の台公園の愛称・ロゴマーク投票を期間中だけページ上部に表示 - 審議会3件(特別職報酬等・文化財保護・都市計画)をmeetings.jsonに追加 --- src/components/Campaigns.astro | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/components/Campaigns.astro (limited to 'src/components') diff --git a/src/components/Campaigns.astro b/src/components/Campaigns.astro new file mode 100644 index 0000000..e0437e9 --- /dev/null +++ b/src/components/Campaigns.astro @@ -0,0 +1,42 @@ +--- +// 期間限定の投票・意見募集(パブリックコメント以外)。 +// データは src/data/schedule/campaigns.json から読む。 +// 期間中(today <= to)だけ表示し、終わったら何も出さない。 +import campaigns from '@/data/schedule/campaigns.json'; + +const pad = (n: number) => String(n).padStart(2, '0'); +const now = new Date(); +const todayKey = `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`; + +const reiwa = (iso: string) => { + const [y, m, d] = iso.split('-').map(Number); + const year = y - 2018 === 1 ? '令和元年' : `令和${y - 2018}年`; + return `${year}${m}月${d}日`; +}; + +type Campaign = { + title: string; + to: string; + from?: string; + url?: string; + contact: string; + note?: string; +}; + +const active = (campaigns as Campaign[]).filter( + (c) => todayKey <= c.to && (!c.from || c.from <= todayKey), +); +--- + +{ + active.length > 0 && ( +
+

募集中(投票・意見募集)

+ +
+ ) +} -- cgit v1.3.1