GraphQL ignores time in query on created_at

Jheroen
Shopify Partner
5 0 0

When I query my orders using the created_at field (which, supposedly, is supported) I get unexpected results.  It looks like the time information in the DateTime field is ignored.  In other words: yyyy-mm-ddTxx:xx:xxZ is interpreted as yyyy-mm-ddT00:00:00Z or yyyy-mm-ddT23:59:59Z for whatever value of xx:xx:xx (depending on the < or < information?).

Hence the query operates on the date only and moreover it uses the date values in UTC at Greenwich.  This can lead to serious reporting issues.

 

Example below (The query should not return anything in my test store, but it returns an order outside the specified range)

 

 

{
orders(first:20, query:"created_at:>2019-12-10T00:00:00Z AND created_at:<2019-12-11T00:00:00Z") {
edges {
node {
name
createdAt}}}}

 

Returns:

... "node": {
"name": "#1006",
"createdAt": "2019-12-11T03:05:12Z"
}

0 Likes
sd_
Shopify Staff (Retired)
Shopify Staff (Retired)
51 10 5

Hi @Jheroen

 

We are aware that this is currently an issue and are actively working on a solution. I'll report back to you with updates shortly.

 

0 Likes
Supermetrics
Shopify Partner
2 0 1

Is this bug fixed already?

 


@sd_ wrote:

Hi @Jheroen

 

We are aware that this is currently an issue and are actively working on a solution. I'll report back to you with updates shortly.

 



?

edrujo
New Member
1 0 0

Is this was fixed already?

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 226

Apparently this is still an issue. In the GraphQL API. Screen shots below. Although you can use query parameters for created_at timestamp ranges and get results just fine in the REST API. For example, https://{my_shop}.myshopify.com/admin/api/2020-07/orders.json?created_at_min=2020-07-08T17:00:00&created_at_max=2020-07-08T17:59:59

Been awhile that it's been a known bug?

orders by timestamp.jpg 

Bodog
Shopify Expert
10 0 5

Can confirm, still an issue for us as well. I was pretty stunned to find out we can't easily retrieve orders between a specific date and time window. Still a problem a year after it was reported.

Greg_Kujawa
Shopify Partner
1016 83 226

Nice! Indeed that did the trick. It's a shame the Shopify GraphQL API documentation doesn't list this in their search syntax section --> https://shopify.dev/concepts/about-apis/search-syntax.

0 Likes