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

Error on date field with end-date #13

Closed
d0t15t opened this issue Jul 6, 2018 · 8 comments
Closed

Error on date field with end-date #13

d0t15t opened this issue Jul 6, 2018 · 8 comments

Comments

@d0t15t
Copy link
Contributor

d0t15t commented Jul 6, 2018

Hi,
we're really enjoying using graphql_api with drupal, thanks so much!

Currently having an issue with date-fields which contain start and end dates - the schema is expecting a string, but receives an object (or array) and returns an error.

"debugMessage": "Expected a value of type \"String\" but received: {\"value\":\"2018-07-06 00:00:00\",\"value2\":\"2018-07-30 00:00:00\",\"timezone\":\"Europe\\/Paris\",\"timezone_db\":\"Europe\\/Paris\",\"date_type\":\"datetime\"}",

When using a date-field with a start date only, the query returns the datestamp as expected, but in this case it would be great to also access the timezone data.

Are you planning to support this? Or could you give any suggestion for how to add the correct schema data for all the date field info?

Thanks!

@olragon
Copy link
Owner

olragon commented Jul 6, 2018

Post your GraphQL query and field config so I can dig deeper

@d0t15t
Copy link
Contributor Author

d0t15t commented Jul 6, 2018

{
  custom_entity__type_1 {
    title
    content_type_1 {
      nid
      title
      custom_entity__type_2 {
        title
        body
        date_field_with_end_date
      }
    }
  }
}

What do you mean exactly by field config? I've renamed the fields to better explain the entity and field types.

@d0t15t
Copy link
Contributor Author

d0t15t commented Jul 6, 2018

On a simpler query, the result is the same.

{
  node_article {
      field_test_date_field		
  }
}

"debugMessage": "Expected a value of type \"String\" but received: {\"value\":\"2016-12-31 23:00:00\",\"value2\":\"2018-05-31 22:00:00\",\"timezone\":\"Europe\\/Paris\",\"timezone_db\":\"UTC\",\"date_type\":\"datetime\"}",

@olragon
Copy link
Owner

olragon commented Jul 7, 2018

What do you mean exactly by field config? I've renamed the fields to better explain the entity and field types.

You add a field date, you need select field type, field name, default value, timezone handling, start/end date .... What did you use for your field?

graphql_api resolve to string when we have no clue about schema types of given field type

@d0t15t
Copy link
Contributor Author

d0t15t commented Jul 7, 2018

What did you use for your field?

I add a field of type 'date' (https://www.drupal.org/project/date). Add a field name, default value of 'now'. Timezone handling set to the same as the website. Set field to record year, month, day, hour, and minute. When using only start-date, graphql_api returns a datetime string. When set to also record an end-date, then graphql_api returns the error mentioned above.

Thank you for looking into it!

@Jehu
Copy link

Jehu commented Jul 16, 2018

@olragon any news here for using start/end date values in date field?

@olragon
Copy link
Owner

olragon commented Jul 16, 2018

@Jehu I've been busy for the last week, try to fix in tomorrow

@olragon
Copy link
Owner

olragon commented Jul 17, 2018

It should be fixed by c1590e8

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

No branches or pull requests

3 participants