Quantcast
Channel: Square Developer Forums - Latest topics
Viewing all articles
Browse latest Browse all 1333

Filter orders in business day for restaurants that stay open past midnight

$
0
0

Hi, I’m building a report for some restaurants, and I’m trying to filter orders by business day using the API. For instance, I would like to get all the orders for April 23, 2024.

I’m using the search orders endpoint, which accepts a start_at and end_at filters. The issue is that some restaurants may stay open past midnight, for instance until 1 AM or 2 AM depending on the restaurant, so it is not so simple as to set start_at=2024-04-23T00:00:00 and end_at=2024-04-23T23:59:59.999.

I would need somehow to know which is the start_at and end_at for the business day, for each restaurant. Do you know a way I could do that? Or any alternative solution?

I know the retrieve location endpoints returns a business hours object, like this:

"business_hours": {
    "periods": [
        {
            "day_of_week": "FRI",
            "start_local_time": "11:00:00",
            "end_local_time": "15:00:00"
        },
        {
            "day_of_week": "FRI",
            "start_local_time": "19:00:00",
            "end_local_time": "23:00:00"
        },
    ]
},

but I don’t think this would be useful for my use case.

3 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 1333

Trending Articles