-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-transformer-remark): don't convert Date objects #10924
Conversation
I actually wonder if this is still problem (fact that Date object are potentially used). I remember fixing inconsistencies when Date object was used, then cached in |
Ah indeed, just checked and it works fine because of |
@stefanprobst @pieh Is this PR still relevant? |
Yeah, it's still worth to get in, will just validate that change now so at least 2 sets of eyes checked it. |
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.
Validated and works as expected. Thanks @stefanprobst!
I have a date field within my project that has some written as strings, and others not (have content creators doing both unfortunately); and this PR appears to be breaking the sorting functionality I'm using. |
<!-- Have any questions? Check out the contributing docs at https://gatsby.app/contribute, or ask in this Pull Request and a Gatsby maintainer will be happy to help :) --> ## Description Quick fix to standardize on date format strings, which appears to have been broken with #10924 ## Related Issues <!-- Link to the issue that is fixed by this PR (if there is one) e.g. Fixes #1234, Addresses #1234, Related to #1234, etc. -->
<!-- Have any questions? Check out the contributing docs at https://gatsby.app/contribute, or ask in this Pull Request and a Gatsby maintainer will be happy to help :) --> ## Description Quick fix to standardize on date format strings, which appears to have been broken with gatsbyjs#10924 ## Related Issues <!-- Link to the issue that is fixed by this PR (if there is one) e.g. Fixes gatsbyjs#1234, Addresses gatsbyjs#1234, Related to gatsbyjs#1234, etc. -->
gatsby-transformer-remark
parses frontmatter withgray-matter
and then iterates through frontmatter fields again to transform Dates into strings.This PR proposes to only allow types from the YAML 1.2 spec, which has no
timestamp
type anymore (the 1.1 spec has). This way, dates will automatically be parsed as strings.For the different
schema
options that the yaml parser accepts see here.