diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-05 14:58:06 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-05 14:58:06 +0900 |
| commit | e7b60d5ef8c8cf5471a62498fd0a88f61cd2812e (patch) | |
| tree | 7a7033fc634baa1d7695dd52e90961e98cfc5e16 /src/lib/schedule-months.ts | |
| parent | 3e02a6a05c6a5b26fbb19fa91be9afbc6b12877d (diff) | |
events: メインは前月以降、アーカイブは前々月以前に分ける
メインページの一覧とカレンダーを前月以降に広げ、前々月以前の月だけを
アーカイブとして生成するようにした。該当が無いときはアーカイブ欄に
その旨を表示する。月が進めば自動でページが増える。
RSSと旧URLの転送先も、存在しない月ページを指さないよう合わせた。
Diffstat (limited to 'src/lib/schedule-months.ts')
| -rw-r--r-- | src/lib/schedule-months.ts | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/lib/schedule-months.ts b/src/lib/schedule-months.ts index 829fef5..bff86a2 100644 --- a/src/lib/schedule-months.ts +++ b/src/lib/schedule-months.ts @@ -4,7 +4,7 @@ // (カレンダー側が必要とする日付計算は src/lib/schedule-dates.ts にある) import meetings from '@/data/schedule/meetings.json'; import events from '@/data/schedule/events.json'; -import { entryDates } from './schedule-dates'; +import { archiveEndMonth, entryDates } from './schedule-dates'; export type Row = { date: string; title: string; place: string; note: string; source: string }; export type Item = { type: 'meeting' | 'event'; row: Row }; @@ -76,3 +76,17 @@ export function rowsInMonths(months: string[], type: 'meeting' | 'event'): Row[] export function rowsInFiscalYear(fy: string, type: 'meeting' | 'event'): Row[] { return rowsInMonths(monthsInFiscalYear(fy), type); } + +/** + * アーカイブ(月別・年度別ページ)に移す月。前々月以前。 + * 前月と当月以降はメインページに残すので、ここには含めない。 + */ +export const archiveMonthKeys: string[] = monthKeys.filter( + (month) => month <= archiveEndMonth(), +); + +/** アーカイブに移す年度(その年度の最後の月が前々月以前のもの) */ +export const archiveFiscalYearKeys: string[] = fiscalYearKeys.filter((fy) => { + const months = monthsInFiscalYear(fy); + return months.length > 0 && months[months.length - 1] <= archiveEndMonth(); +}); |
