From c0f61ba314bb2ed0503ec1a00cda0e8e15f89e2d Mon Sep 17 00:00:00 2001 From: yyamashita Date: Sat, 11 Jul 2026 20:34:45 +0900 Subject: =?UTF-8?q?Fix=20day-of-week=20bug=20in=20recap=20mail:=20getDay()?= =?UTF-8?q?=E2=86=92getUTCDay()=20on=20noon=20UTC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit +09:00 midnight をパースすると内部では前日15:00UTCになり、 getDay()がシステムタイムゾーン(UTC)で前日の曜日を返していた。 Co-Authored-By: Claude Sonnet 4.6 --- scripts/send-recap.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/send-recap.ts b/scripts/send-recap.ts index b41059c..27aac74 100644 --- a/scripts/send-recap.ts +++ b/scripts/send-recap.ts @@ -37,10 +37,9 @@ function isoDate(d: Date): string { function fmtJST(dateStr: string): string { const DOW = ["日", "月", "火", "水", "木", "金", "土"]; - // Parse as JST midnight - const d = new Date(`${dateStr}T00:00:00+09:00`); + const d = new Date(`${dateStr}T12:00:00Z`); const [y, m, day] = dateStr.split("-"); - return `${y}/${m}/${day}(${DOW[d.getDay()]})`; + return `${y}/${m}/${day}(${DOW[d.getUTCDay()]})`; } // ---- database ---------------------------------------------------------- -- cgit v1.2.3