Date_from filter with timestamps?

Hello! I was wondering if there is any way to use a more granular date/time filter when using queries that have a date filter. I can only seem to get full dates to work, but I can’t find any way to cut off by a specific time. Here’s my example using the picks_per_day query:

query {
    picks_per_day(date_from: "2019-09-30") {
        request_id
        complexity
        data(first: 5, sort:"created_at") {
            pageInfo {
                hasPreviousPage
                hasNextPage
                endCursor
            }
            edges {
                cursor
                node {
                    id
                    line_item_id
                    user_first_name
                    user_last_name
                    order_number
                    sku
                    picked_quantity
                    inventory_bin
                    barcode_scanned
                    created_at
                }
            }
        }
    }
}

So, for example, if I used this at 2pm yesterday to pull all of the picks so far for that day, and then used it again this morning, this would download everything from yesterday, including everything I had already downloaded prior to 2pm.

I’m not sure if times are stored in UTC or something more like local time, but for the sake of example, let’s say it’s local time. I tried supplying something like “2019-09-30 14:00:00”, and I even tried formatting it exactly like the output the query gives, such as “2019-09-30T14:00:00.000Z”, but both of them give me an error of something like : Expected type “Date”, found “2019-09-30T14:00:00.000Z”.

Is there any way I can specify a full timestamp as a filter instead of just a date? If it’s not currently possible, could it please be added as a feature request for any queries that allow for date filtration and return timestamps?

If it helps, this is important because if we have more than 5000-ish picks in a day, I’ll never be able to export those from the end of the day due to the quota limits. I could do a second query that would sort them in reverse order, I suppose, but as a growing company, if we ever hit a time where we pick more than 10000-ish in a day (which could happen during the holidays) we would absolutely never be able to get the picks from the middle of the day.

Thanks,
Jeremy

@jeremyw how are you doing? We’ve made change in the input type for those date filters, it should now accept dates and datetimes. Let me know if that works for you.

By the way, all dates are stored as UTC

1 Like

Hi @seba! I’m doing well! :slight_smile:

I tried it out, and it seems to work well. One thing I did notice is that if anyone is using a separate variables json object to pass their variables in, and if they were previously using “Date” as the type for “date_from” or “date_to”, it now gives an error that it’s expecting type ISODateTime. In other words, it could break a lot of existing queries as of right now.

For example, this no longer works:

query($date_from: Date, $date_to: Date, ...)

And it would need to be updated to this:

query($date_from: ISODateTime, $date_to: ISODateTime, ...)

Thanks for the UTC tip, too.

1 Like