Skip to content

fix: show blog dates in the frontmatter calendar day - #2650

Open
drishtyraghav0001 wants to merge 1 commit into
json-schema-org:mainfrom
drishtyraghav0001:fix/blog-dates-utc-timezone
Open

drishtyraghav0001 wants to merge 1 commit into
json-schema-org:mainfrom
drishtyraghav0001:fix/blog-dates-utc-timezone

Conversation

@drishtyraghav0001

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bugfix

Issue Number:

Screenshots/videos:

n/a, dates only. in a timezone west of UTC, a post dated 2023-05-08 was showing as Sunday, May 7, 2023. it now shows Monday, May 8, 2023, same as the frontmatter, wherever you are.

If relevant, did you update the documentation?

no

Summary

frontmatter dates like "2023-05-08" were parsed as midnight UTC and then formatted in the visitor's local timezone, so anyone west of UTC saw the previous day. that happened on the blog post page and the blog list cards.

there's a small formatBlogDate helper that treats the frontmatter value as a calendar date and always formats it in UTC, so the same day shows everywhere. also zero-padded the one non-ISO date (2026-5-16 in the apidays paris recap) so it parses the same way as the other posts.

added cypress/components/formatBlogDate.cy.tsx (4 tests). lint, typecheck and those tests pass locally, including with TZ=America/New_York.

Does this PR introduce a breaking change?

no

Checklist

ISO dates like 2023-05-08 were parsed as midnight UTC and then
formatted in the visitor's local timezone, so anyone west of UTC
saw the previous day. Format them in UTC and zero-pad the one
non-ISO frontmatter date so the same day shows everywhere.

Signed-off-by: Drishty Raghav <273601396+drishtyraghav0001@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
website ✅ Ready (View Log) Visit Preview 3e13565

@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7b7b58b) to head (3e13565).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2650   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           31        31           
  Lines          737       737           
  Branches       229       229           
=========================================
  Hits           737       737           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vtushar06

Copy link
Copy Markdown
Collaborator

LGTM @drishtyraghav0001 Thanks for following our guidelines while contirbuting.

This branch was successfully deployed

1 active deployment
Preview — 3e13565d Deployed Nov 13, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready to review

Development

Successfully merging this pull request may close these issues.

🐛 Bug: Blog post dates show one day early for visitors west of UTC

2 participants