GraphQL Orders returning datetime without milliseconds but requests use milliseconds to filter order

So I’m trying to fetch orders based on their updated_at datetime using graphql. Once I have the orders, I store the updated_at time of the newest order and my next call uses that time to fetch only orders updated after it.

Here’s my api call, it works and gives me the expected orders

query Orders {
    orders(first: 2, 
    query: "updated_at:>'2024-08-01T00:00:00Z'", 
    sortKey: UPDATED_AT) {
        edges {
            cursor
            node {
                id
                name
                updatedAt
                createdAt
                customer {
                    id
                }
            }
        }
        pageInfo {
            hasNextPage
            endCursor
        }
    }
}

Here is its response:

{
    "data": {
        "orders": {
            "edges": [
                {
                    "cursor": "xxx",
                    "node": {
                        "id": "gid://shopify/Order/5316688937038",
                        "name": "#1001",
                        "updatedAt": "2024-08-27T10:41:21Z",
                        "createdAt": "2024-07-29T12:23:12Z",
                        "customer": {
                            "id": "gid://shopify/Customer/7237957517390"
                        }
                    }
                },
                {
                    "cursor": "xxx",
                    "node": {
                        "id": "gid://shopify/Order/5358304886862",
                        "name": "#1002",
                        "updatedAt": "2024-08-27T13:11:12Z",
                        "createdAt": "2024-08-27T10:51:37Z",
                        "customer": {
                            "id": "gid://shopify/Customer/7237957517390"
                        }
                    }
                }
            ],
            "pageInfo": {
                "hasNextPage": false,
                "endCursor": "xxx"
            }
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 4,
            "actualQueryCost": 4,
            "throttleStatus": {
                "maximumAvailable": 2000,
                "currentlyAvailable": 1996,
                "restoreRate": 100
            }
        }
    }
}

Now what I expect to happen is that if I save the updated at datetime of the second order (2024-08-27T13:11:12Z) and use that to make my next api call I should get orders AFTER that datetime. But thats not whats happening.

Call:

query Orders {
    orders(first: 2, 
    query: "updated_at:>'2024-08-27T13:11:12Z'", 
    sortKey: UPDATED_AT) {
        edges {
            cursor
            node {
                id
                name
                updatedAt
                createdAt
                customer {
                    id
                }
            }
        }
        pageInfo {
            hasNextPage
            endCursor
        }
    }
}

Response (I get 1002 again):

{
    "data": {
        "orders": {
            "edges": [
                {
                    "cursor": "xxx",
                    "node": {
                        "id": "gid://shopify/Order/5358304886862",
                        "name": "#1002",
                        "updatedAt": "2024-08-27T13:11:12Z",
                        "createdAt": "2024-08-27T10:51:37Z",
                        "customer": {
                            "id": "gid://shopify/Customer/7237957517390"
                        }
                    }
                }
            ],
            "pageInfo": {
                "hasNextPage": false,
                "endCursor": "xxx"
            }
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 4,
            "actualQueryCost": 4,
            "throttleStatus": {
                "maximumAvailable": 2000,
                "currentlyAvailable": 1996,
                "restoreRate": 100
            }
        }
    }
}

Upon investigating i have concluded that internally Shopify is storing milliseconds as well in the datetime but its not returning it. I concluded this because if I use 2024-08-27T13:11:12Z or 2024-08-27T13:11:12.000Z I get the same 1002 order again but if I use 2024-08-27T13:11:12.999Z then I dont get the order.

So how do I get the milliseconds from Shopify?

Hi @nabeelfarooqui

This should be a bug in the shopify api.