-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Resolve date discrepancy and remove tinytime dependency #1812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@adamwathan The |
Switched to Node 20 and triggered a redeploy, cross your fingers! 😄 |
src/layouts/BlogPostLayout.js
Outdated
hour: 'numeric', | ||
minute: 'numeric', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yup! I updated those last and must've copied the wrong object. Updating that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be resolved now via 42d3fde
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Awesome thanks @brandonmcconnell! |
👋🏼 NOTE: I am reopening this as a follow-up to #1811. I closed that one thinking that I might need to install another dependency to polyfill
Intl.DateTimeFormat
for server use, but that does not appear to be the case.I'm unable to inspect the failures that caused the previous PR's build to fail, as I am not part of the
tailwindlabs
org on Vercel and do not have access to thetailwindlabs/tailwindcss-com
resource.If you report the failures here, I can take a stab at resolving them.
This PR will…
resolve a date mismatch issue caused by
tinytime
not preserving timezone informationI noticed this when sharing the job app links on Twitter. I'm not sure if this occurs in every time zone, or if I'm only seeing it because I'm currently traveling in Los Angeles.
refactor and improve the
formatDate
functionrefactor and improve the
formatDate
function to build upon built-in APIsMost of what tinytime was being used for can be offloaded to
Intl.DateTimeFormat
, which is natively supported with great browser support.The only regression/difference I noticed was that in the case of the job applications usage of
formatDate
, you lose the ordinal day number (e.g.4
now instead of4th
). If that's an important difference and you really want the ordinal number there, I have a helper that essentially shims'ordinal
support for the day number. It would just be a deviation from the built-inIntl.DateTimeFormatOptions
type, so if you do any TS type checking, you'll want to account for that as well.removes the—now unused—the
tinytime
dependency