Skip to content
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

[nextra-theme-blog]: fix Application error: a client-side exception has occurred when invalid date was provided in frontmatter + TESTS #612

Merged
merged 2 commits into from
Jul 30, 2022

Conversation

dimaMachina
Copy link
Collaborator

@dimaMachina dimaMachina commented Jul 29, 2022

related #609

Date constructor in some browsers has different behaviour
In chrome follow date is valid:

https://github.com/numToStr/site/blob/8fef54ca4d778515cf94c8b277b1006774dd8a22/pages/blog/lsp-neovim-retrospective.mdx?plain=1#L4

image

But in Safari
image

This PR assert frontmatter date to be equal for the following formats:

  • YYYY/M/D
  • YYYY/M/D H:m
  • YYYY-MM-DD
  • [YYYY-MM-DD]T[HH:mm]
  • [YYYY-MM-DD]T[HH:mm:ss.SSS]Z

cc @numToStr

@changeset-bot
Copy link

changeset-bot bot commented Jul 29, 2022

🦋 Changeset detected

Latest commit: 679be4b

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jul 29, 2022

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

Name Status Preview Updated
nextra-theme-docs-dev ✅ Ready (Inspect) Visit Preview Jul 30, 2022 at 0:17AM (UTC)
1 Ignored Deployment
Name Status Preview Updated
nextra ⬜️ Ignored (Inspect) Jul 30, 2022 at 0:17AM (UTC)

@@ -28,6 +28,7 @@
"dev:tailwind": "cross-env TAILWIND_MODE=watch pnpm postcss src/styles.css -o style.css --watch",
"prepublishOnly": "pnpm build",
"clean": "rimraf ./dist ./style.css",
"test": "vitest run",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing test script for blog cc @promer94

@numToStr
Copy link
Contributor

This is brilliant! Thanks @B2o5T. I never imagined that the date was the issue, and apparently safari didn't liked that date format.

…has occurred` when invalid date was provided in frontmatter + TESTS
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.

3 participants