diff options
| author | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-07-11 20:34:45 +0900 |
|---|---|---|
| committer | yyamashita <yyamashita@hetzner.yyamashita.com> | 2026-07-11 20:34:45 +0900 |
| commit | c0f61ba314bb2ed0503ec1a00cda0e8e15f89e2d (patch) | |
| tree | ebb416efce73401078bb00c5c03a4ffe23e4a67e /scripts | |
| parent | baf91fb9f8ce918c3c10e89710605176539136ed (diff) | |
Fix day-of-week bug in recap mail: getDay()→getUTCDay() on noon UTC
+09:00 midnight をパースすると内部では前日15:00UTCになり、
getDay()がシステムタイムゾーン(UTC)で前日の曜日を返していた。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/send-recap.ts | 5 |
1 files changed, 2 insertions, 3 deletions
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 ---------------------------------------------------------- |
