Repository navigation
fix: show blog dates in the frontmatter calendar day - #2650
Open
drishtyraghav0001 wants to merge 1 commit into
Open
drishtyraghav0001 wants to merge 1 commit into
drishtyraghav0001 wants to merge 1 commit into
Conversation
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>
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Collaborator
|
LGTM @drishtyraghav0001 Thanks for following our guidelines while contirbuting. |
vtushar06
approved these changes
Nov 17, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-08was 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
formatBlogDatehelper 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-16in 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 withTZ=America/New_York.Does this PR introduce a breaking change?
no
Checklist