aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/lib/schedule-dates.ts
diff options
context:
space:
mode:
authorYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-11-05 13:30:26 +0900
committerYasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com>2026-11-05 13:30:26 +0900
commitbb74335a2fc1b0697c2b7088b010484ade784519 (patch)
tree39f8033b3d19af3f1376a222725bae6de816c98e /src/lib/schedule-dates.ts
parent248d64c096930fa031ce48ddaa4cdb30681918fa (diff)
events: 月別アーカイブページを追加
- /kodaira-data/events/YYYY-MM/ をデータから自動生成(2026年10月〜2027年3月の6か月分) - 会議とイベントを月ごとに表示し、前月・翌月のリンクを設置 - 行事予定ページ下部に月別アーカイブのリンクを追加 - 日付計算を共通モジュール化し、カレンダーと生成ページで同じ結果になるようにした
Diffstat (limited to 'src/lib/schedule-dates.ts')
-rw-r--r--src/lib/schedule-dates.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/schedule-dates.ts b/src/lib/schedule-dates.ts
index 5f0900b..719a9c6 100644
--- a/src/lib/schedule-dates.ts
+++ b/src/lib/schedule-dates.ts
@@ -128,3 +128,23 @@ export function parseDates(raw: string): string[] {
return [...dates].sort();
}
+
+/**
+ * 行事予定1行分の開催日を求める。
+ * - 会議:日付セルに加えて、時間・会場セル内の日付も拾う(「毎月1回(11月12日も開催)」など)
+ * - イベント:時間セルの「(11月4日を除く)」を反映する
+ * カレンダー(ブラウザ)と月別アーカイブ(ビルド時)で同じ結果になるよう、ここに集約する。
+ */
+export function entryDates(
+ type: 'meeting' | 'event',
+ dateText: string,
+ placeText: string,
+): string[] {
+ const dates = new Set(parseDates(dateText));
+ if (type === 'meeting') {
+ for (const key of parseDates(placeText)) dates.add(key);
+ } else {
+ applyExclusions(dates, placeText);
+ }
+ return [...dates].sort();
+}