Skip to content

Resolve date discrepancy and remove need for tinytime dependency #1811

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

Closed
wants to merge 2 commits into from

Conversation

brandonmcconnell
Copy link

This PR will…

  1. resolve a date mismatch issue caused by tinytime not preserving timezone information

    I 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.

  2. refactor and improve the formatDate function

    1. refactor and improve the formatDate function to build upon built-in APIs

      Most 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 of 4th). 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-in Intl.DateTimeFormatOptions type, so if you do any TS type checking, you'll want to account for that as well.

    2. removes the—now unused—the tinytime dependency

Copy link

vercel bot commented Apr 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
tailwindcss-com ❌ Failed (Inspect) Apr 1, 2024 4:02am

@brandonmcconnell
Copy link
Author

Going to close this PR and give it some more thought, seeing as the Intl.DateTImeFormat might need to be imported or at least configured specifically for this Next.js env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant