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

Unknown argument \"formatString\" on field \"date\" of type \"frontmatter_2\". #2173

Closed
kripod opened this issue Sep 19, 2017 · 10 comments
Closed

Comments

@kripod
Copy link
Contributor

kripod commented Sep 19, 2017

Since upgrading from Gatsby v1.9.33 to v1.9.39, I get the error message showcased in the issue title when running a query similar to the gatsby-plugin-remark usage example:

allMarkdownRemark {
  edges {
    node {
      frontmatter {
        date(formatString: "YYYY-MM-DD")
      }
    }
  }
}

I'm not sure about the cause, but found an issue which might be related to the problem: #2096

@KyleAMathews
Copy link
Contributor

The problem is your date field isn't being inferred as a "date".

I'd look at your posts to see if some of the fields aren't valid. These are the supported formats

@kripod
Copy link
Contributor Author

kripod commented Sep 20, 2017

My date formats were correct, but it turns out that dates now have to be put inside quotes, so

  • date: 2000-01-01 doesn't work
  • date: "2000-01-01" works
@kripod kripod closed this as completed Sep 20, 2017
@kripod kripod reopened this Sep 20, 2017
@kripod
Copy link
Contributor Author

kripod commented Sep 20, 2017

After a bit of thinking, I'm not sure about when quotes should be used inside a front matter. According to the Jekyll Front Matter docs, quotes should not be necessary.

@KyleAMathews
Copy link
Contributor

They're not. Thanks easiest way for me to help you would be if you could build me a site reproducing the problem like Joseph did here #2096 (comment)

@kripod
Copy link
Contributor Author

kripod commented Sep 20, 2017

Clone this repository at 865a0ad75214e85304edbf72906abde6b3a1d040 and then run yarn upgrade-interactive, selecting everything related to Gatsby. I've put all the dates inside quotes in my next commit.

KyleAMathews added a commit that referenced this issue Sep 20, 2017
@KyleAMathews
Copy link
Contributor

Thanks for the reproduction! Problem was I didn't actually fix the issue in my last PR… I used Date.toString instead of Date.toJSON which meant that the serialized dates weren't recognizable as dates later when inferring the GraphQL schema!

New PR is up fixing this, thanks again for testing! Also nice looking site :-)

kripod added a commit to simonyiszk/mvk-web that referenced this issue Sep 20, 2017
This was made possible by the fix provided for gatsbyjs/gatsby#2173
@rchrdnsh
Copy link

rchrdnsh commented Nov 4, 2018

I'm running into this now, not sure what to change, tho.

@rchrdnsh
Copy link

rchrdnsh commented Nov 4, 2018

oh, i get it now...I have to put a 0 before a date that does not have two digits, like the first 9 days of a month...that's a bit annoying... :-/

@discordianfish
Copy link

@KyleAMathews It would be so, so useful if the error returned which document it happened on.

@chancesmith
Copy link

Agreed! What post do I need to fix?

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