Closed chrispytoes closed 3 years ago
This is because WPGraphQL doesn't have a date time scalar so there's no way to programatically determine which fields are date fields by analyzing the remote schema. If you look at this file
You can see where it's hardcoded to date
, dateGmt
and modified
.
I would recommend opening an issue on the WPGraphQL repo requesting a DateTime scalar 👍
Alternatively we would accept a PR adding a plugin option like so:
{
options: {
schema: {
addDateFields: [`yourFieldName`]
}
}
}
That option could be made to add additional fields to the Date type-filter so that you can set additional fields as Date fields.
@TylerBarnes Thanks for the response. That's interesting, I would have thought that WPGraphQL would know the types based off of the field settings in ACF.
I did manage to get it working by overriding the type myself using createTypes
within the createSchemaCustomization
hook. Looks like a newer feature, docs here. This works and serves my purposes for now.
Great to hear that that works :) WPGraphQL does know the types but isn't exposing that one yet. Once it's added to WPGQL we'll be adding automatic support on the Gatsby side for sure.
I'm cleaning up this repo and so I'm moving this to our internal backlog - we're still waiting on WPGQL support for this so we can't do anything yet.
I have an ACF DateTime field that I need to query by using
gte
andlte
. However, unless the ACF field is explicitly nameddate
, it does not get recognized as a date. I've tried several different date formats and none of them work. Unless my date field is nameddate
, GraphQL reads it as a string.