Dev Log
Fix: /log/ entries displayed one day behind their frontmatter date
What was done
- Added
timeZone: "UTC"to thetoLocaleDateString("en-US", ...)call onsrc/pages/log/index.astro(line 31) andsrc/pages/log/[slug].astro(line 17).
Why
Caught while verifying the prior build was FTP-ready. Frontmatter date: 2026-04-23 is parsed as a Date representing 2026-04-23T00:00:00Z (UTC midnight). Without an explicit timeZone option, toLocaleDateString uses the build machine’s local timezone — Mountain Time (UTC-6 / UTC-7) on this dev machine — and renders midnight UTC as the previous evening local, shifting every displayed date one day earlier than the frontmatter intended. The <time datetime> attribute was correct (.toISOString().slice(0, 10)), only the human-readable display was wrong.
Effect was sitewide on /log/: every entry rendered one day behind its actual date. Today’s entry showed “Apr 22” instead of “Apr 23”; the prior entry showed “Apr 21” instead of “Apr 22”; etc.
Files affected
- Modified:
src/pages/log/index.astro(one-line addition to date formatter) - Modified:
src/pages/log/[slug].astro(one-line addition to date formatter) - Created:
src/content/devlog/2026-04-23-log-date-utc-fix.md(this entry)