fix: parse blog dates as local time to avoid UTC offset#38
Merged
ajbozarth merged 3 commits intogenerative-computing:mainfrom May 6, 2026
Merged
Conversation
Using new Date(dateStr) with an ISO date-only string parses as UTC midnight, which shifts to the previous day in US timezones. Switch to the same split-based construction used in BlogCard so both pages render the same date. Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
Contributor
Author
|
Found this while testing #36 |
Bare YYYY-MM-DD strings are parsed as UTC midnight by OG metadata consumers, shifting the displayed date one day earlier for readers in UTC-behind timezones. Using T12:00:00 preserves the correct calendar day across all UTC offsets. Closes generative-computing#40 Signed-off-by: Alex Bozarth <ajbozart@us.ibm.com>
Contributor
Author
|
Updated to include a fix for #40 as it was around the same timezone issue |
psschwei
reviewed
May 6, 2026
Co-authored-by: Paul Schweigert <paul@paulschweigert.com>
psschwei
approved these changes
May 6, 2026
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.
Summary
new Date("YYYY-MM-DD")parses ISO date-only strings as UTC midnight, shifting the displayed date one day earlier in US timezones. Switched to the same split-basednew Date(year, month - 1, day)construction used inBlogCardso both the listing and individual post pages render the same date. Closes the gap missed when fix: blog grid partial-row grey background and date off-by-one #16 fixed the same issue inBlogCard.tsx.publishedTimewas passing a bareYYYY-MM-DDstring, which strict consumers (LinkedIn, Slack, Google) parse as UTC midnight — producing the wrong date on social unfurls and search snippets. Qualified withT12:00:00so the calendar day is preserved across all UTC offsets. Closes fix: publishedTime OG field passes bare YYYY-MM-DD string, parsed as UTC midnight by consumers #40.Test plan
TZ=America/Chicagolocally)<meta property="article:published_time">on a post page — should be e.g.2025-01-15T12:00:00