From 489f7a44d3749c149134a03324ca758cbd663d39 Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Sat, 7 Nov 2026 08:40:39 +0900 Subject: events: 更新日に時刻を入れ、再読み込みの案内を追加 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 最終更新を「2026年11月7日 08:40」のように時刻まで表示するように した。キャッシュで新しい情報が出ないときは Ctrl+F5 などを促す一文も 添えた。あわせて dateModified を現地時刻(+09:00)に直した。 --- src/components/ScheduleSeo.astro | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/components') 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 = {
最終更新:{label}
++ 新しい情報が表示されないときは、ページが保存(キャッシュ)されている可能性があります。 + ブラウザで再読み込み(Windowsは Ctrl+F5、Macは Command+Shift+R など)をお試しください。 +
-- cgit v1.3.1