-
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
Add date formatting query options to lists of date strings in YAML in addition to scalars #3556
Comments
Oooo yeah, we're missing this still. Check out the code here:
When a Do you feel up to doing a PR to add support for this? We'd need to abstract out the arguments and resolve function for the date field so it works for both scalar and list values. |
Yeah, I'm happy to help 🙂 Can you point me towards the tests that cover this? |
Great!! Here's the tests for inferring dates
Just add an array of date strings similar to your example in the initial issue description. |
Description
The
gatsby-transformer-yaml
plugin has a great behavior for parsing date strings and exposing them as rich Dates with the ability to format them through GraphQL query parameters! The ability to write simple, human-readable date strings like2018-01-01
in YAML and have a rich date to query against for things like days of the week, abbreviations, etc., is excellent.I was disappointed to discover that this feature is limited to scalars. Creating a list of date strings exposes no ability to format all of them through the query.
My workaround is to add another object layer, e.g. a list of objects that have a single property called date, but it would be nice to not have to do that.
Environment
Gatsby version: 1.9.151
Node.js version: 8.9
Operating System: macOS Siera 10.12.6
Example
Data
Query
Desired result
Current result
The text was updated successfully, but these errors were encountered: