diff options
| author | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-07 08:40:39 +0900 |
|---|---|---|
| committer | Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> | 2026-11-07 08:40:39 +0900 |
| commit | 489f7a44d3749c149134a03324ca758cbd663d39 (patch) | |
| tree | 8033f2f4ba02c09f630499447cfc16703ca246e3 /src/components/ScheduleSeo.astro | |
| parent | a386ca0ce7f8af2a6093e63b1ad698df5f009cf9 (diff) | |
events: 更新日に時刻を入れ、再読み込みの案内を追加
最終更新を「2026年11月7日 08:40」のように時刻まで表示するように
した。キャッシュで新しい情報が出ないときは Ctrl+F5 などを促す一文も
添えた。あわせて dateModified を現地時刻(+09:00)に直した。
Diffstat (limited to 'src/components/ScheduleSeo.astro')
| -rw-r--r-- | src/components/ScheduleSeo.astro | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/components/ScheduleSeo.astro b/src/components/ScheduleSeo.astro index 77c02a2..b87ec5b 100644 --- a/src/components/ScheduleSeo.astro +++ b/src/components/ScheduleSeo.astro @@ -7,11 +7,20 @@ import { entryDates } from '@/lib/schedule-dates'; // URLは src/data/schedule/config.ts で一元管理している(ページ移転時はそこだけ変える) const url = scheduleAbsoluteUrl(); const updated = new Date(); -const iso = updated.toISOString().slice(0, 10); -const label = `${updated.getFullYear()}年${updated.getMonth() + 1}月${updated.getDate()}日`; - const pad = (n: number) => String(n).padStart(2, '0'); -const todayKey = `${updated.getFullYear()}-${pad(updated.getMonth() + 1)}-${pad(updated.getDate())}`; + +// 表示は日本時間のビルド時刻。dateModified はタイムゾーン付きで出す。 +const year = updated.getFullYear(); +const month = updated.getMonth() + 1; +const day = updated.getDate(); +const iso = `${year}-${pad(month)}-${pad(day)}`; +const label = `${year}年${month}月${day}日 ${pad(updated.getHours())}:${pad(updated.getMinutes())}`; +const offsetMinutes = -updated.getTimezoneOffset(); +const offsetSign = offsetMinutes >= 0 ? '+' : '-'; +const offsetAbs = Math.abs(offsetMinutes); +const isoDateTime = `${iso}T${pad(updated.getHours())}:${pad(updated.getMinutes())}:00${offsetSign}${pad(Math.floor(offsetAbs / 60))}:${pad(offsetAbs % 60)}`; + +const todayKey = iso; // 構造化データに入れるのは、ビルド日から1週間先までの予定(近い予定に絞る) const until = new Date(updated.getFullYear(), updated.getMonth(), updated.getDate() + 7); @@ -68,7 +77,7 @@ const data = { '小平市のイベント・行事予定を月ごとのカレンダーで見られます。審議会・市議会の日程・会場・申込期限を一覧にし、カテゴリ別の絞り込みと地図で確認できます。', url, inLanguage: 'ja', - dateModified: iso, + dateModified: isoDateTime, about: [ { '@type': 'Thing', name: '小平市のイベントカレンダー' }, { '@type': 'Thing', name: '小平市の審議会・市議会の日程' }, @@ -113,3 +122,7 @@ const eventList = { <script type="application/ld+json" set:html={JSON.stringify(eventList)} /> <p class="schedule-updated">最終更新:{label}</p> +<p class="schedule-cache-note"> + 新しい情報が表示されないときは、ページが保存(キャッシュ)されている可能性があります。 + ブラウザで再読み込み(Windowsは Ctrl+F5、Macは Command+Shift+R など)をお試しください。 +</p> |
