> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# CalculateAvailableDatesInRange

# Package: onlineOrders

# Namespace: OperationsService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/restaurants/online-orders/operations/calculate-available-dates-in-range.md

## Permission Scopes:
Manage Restaurants - all permissions: SCOPE.RESTAURANTS.MEGA-SCOPES

## Introduction

Calculates all available dates of each fulfillment type within the specified time range.

A date is considered available if it has at least one available time slot.
Dates are returned in descending order, latest first.

When you specify a delivery address, only delivery fulfillment methods whose delivery area contains the address are considered. Without an address, all delivery fulfillment methods are considered, regardless of their delivery area.

---

## REST API

### Schema

```
 Method: calculateAvailableDatesInRange
 Description: Calculates all available dates of each fulfillment type within the specified time range.  A date is considered available if it has at least one available time slot. Dates are returned in descending order, latest first.  When you specify a delivery address, only delivery fulfillment methods whose delivery area contains the address are considered. Without an address, all delivery fulfillment methods are considered, regardless of their delivery area.
 URL: https://www.wixapis.com/restaurants-operations/v1/operations/{operationId}/available-dates
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  operationId, from, until
 Method parameters: 
   param name: deliveryAddress | type: Address | description: Physical address  
    - ONE-OF: 
     - name: streetAddress | type: StreetAddress | description: Street name and number.  
        - name: number | type: string | description: Street number.  
        - name: name | type: string | description: Street name.  
        - name: apt | type: string | description: Apartment number.  
        - name: formattedAddressLine | type: string | description: Optional address line 1  
     - name: addressLine | type: string | description: Main address line, usually street and number as free text.  
        - name: country | type: string | description: Country code.  | validation: format COUNTRY
        - name: subdivision | type: string | description: Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2).  
        - name: city | type: string | description: City name.  
        - name: postalCode | type: string | description: Zip/postal code.  
        - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains Apt, Suite, and Floor.  
        - name: formattedAddress | type: string | description: A string containing the full address of this location.  
        - name: hint | type: string | description: Free text to help find the address.  
        - name: geocode | type: AddressLocation | description: Coordinates of the physical address.  
           - name: latitude | type: number | description: Address latitude.  | validation: format double
           - name: longitude | type: number | description: Address longitude.  | validation: format double
        - name: countryFullname | type: string | description: Country full name.  
        - name: subdivisionFullname | type: string | description: Subdivision full name.  
        - name: subdivisions | type: array<Subdivision> | description: Multi-level subdivisions from top to bottom.  | validation: maxItems 6
           - name: code | type: string | description: Short subdivision code.  
           - name: name | type: string | description: Subdivision full name.  
   param name: from | type: Date   | required: true 
        - name: day | type: integer | description: The day of the month.  | validation: minimum 1, maximum 31
        - name: month | type: integer | description: The month of the year.  | validation: minimum 1, maximum 12
        - name: year | type: integer | description: The year of the date.  | validation: minimum 2023, maximum 2200
   param name: operationId | type:   none | required: true 
   param name: until | type: Date   | required: true 
        - name: day | type: integer | description: The day of the month.  | validation: minimum 1, maximum 31
        - name: month | type: integer | description: The month of the year.  | validation: minimum 1, maximum 12
        - name: year | type: integer | description: The year of the date.  | validation: minimum 2023, maximum 2200
 Return type: CalculateAvailableDatesInRangeResponse
  - name: availableDatesPerFulfillmentType | type: array<FulfillmentTypeAvailableDates> | description: Available dates of each fulfillment type within the specified time range.  Contains all dates that have at least one available time slot.  
     - name: fulfilmentType | type: FulfillmentType | description: Fulfillment type.  
         - enum:
         -     PICKUP: Pickup fulfillment. The customer picks up the order from the restaurant.
         -     DELIVERY: Delivery fulfillment. The restaurant, or a representative, delivers the order to the customer.
     - name: dates | type: array<Date> | description: Available dates in descending order, latest first.  Contains all dates that have at least one available time slot for this fulfillment type.  | validation: minItems 1, maxItems 100
        - name: day | type: integer | description: The day of the month.  | validation: minimum 1, maximum 31
        - name: month | type: integer | description: The month of the year.  | validation: minimum 1, maximum 12
        - name: year | type: integer | description: The year of the date.  | validation: minimum 2023, maximum 2200


```

### Examples

### Calculate available dates in a date range
```curl
curl -X GET \
'https://www.wixapis.com/restaurants-operations/v1/operations/48605ac5-53fc-49b4-96b2-87f7636f5ce0/available-dates?from.year=2025&from.month=12&from.day=20&until.year=2025&until.month=12&until.day=26' \
-H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.restaurants.operations.calculateAvailableDatesInRange(operationId, options)
 Description: Calculates all available dates of each fulfillment type within the specified time range.  A date is considered available if it has at least one available time slot. Dates are returned in descending order, latest first.  When you specify a delivery address, only delivery fulfillment methods whose delivery area contains the address are considered. Without an address, all delivery fulfillment methods are considered, regardless of their delivery area.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  operationId, options.from, options.until, options
 Method parameters: 
   param name: operationId | type: string | description: Operation GUID. | required: true | validation: format GUID
   param name: options | type: CalculateAvailableDatesInRangeOptions  none | required: true 
        - name: deliveryAddress | type: Address | description: Delivery address.  When you specify a delivery address, only delivery fulfillment methods whose delivery area contains the address are considered. Without an address, all delivery fulfillment methods are considered, regardless of their delivery area.  
           - ONE-OF: 
              - name: streetAddress | type: StreetAddress | description: Street name and number.  
                 - name: number | type: string | description: Street number.  
                 - name: name | type: string | description: Street name.  
                 - name: apt | type: string | description: Apartment number.  
                 - name: formattedAddressLine | type: string | description: Optional address line 1  
              - name: addressLine | type: string | description: Main address line, usually street and number as free text.  
           - name: country | type: string | description: Country code.  | validation: format COUNTRY
           - name: subdivision | type: string | description: Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2).  
           - name: city | type: string | description: City name.  
           - name: postalCode | type: string | description: Zip/postal code.  
           - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains Apt, Suite, and Floor.  
           - name: formattedAddress | type: string | description: A string containing the full address of this location.  
           - name: hint | type: string | description: Free text to help find the address.  
           - name: geocode | type: AddressLocation | description: Coordinates of the physical address.  
              - name: latitude | type: number | description: Address latitude.  
              - name: longitude | type: number | description: Address longitude.  
           - name: countryFullname | type: string | description: Country full name.  
           - name: subdivisionFullname | type: string | description: Subdivision full name.  
           - name: subdivisions | type: array<Subdivision> | description: Multi-level subdivisions from top to bottom.  | validation: maxItems 6
              - name: code | type: string | description: Short subdivision code.  
              - name: name | type: string | description: Subdivision full name.  
        - name: from | type: Date | description: Start date and time of the range. | required: true 
           - name: day | type: integer | description: The day of the month.  | validation: minimum 1, maximum 31
           - name: month | type: integer | description: The month of the year.  | validation: minimum 1, maximum 12
           - name: year | type: integer | description: The year of the date.  | validation: minimum 2023, maximum 2200
        - name: until | type: Date | description: End date and time of the range. | required: true 
 Return type: PROMISE<CalculateAvailableDatesInRangeResponse>
  - name: availableDatesPerFulfillmentType | type: array<FulfillmentTypeAvailableDates> | description: Available dates of each fulfillment type within the specified time range.  Contains all dates that have at least one available time slot.  
     - name: fulfilmentType | type: FulfillmentType | description: Fulfillment type.  
         - enum:
         -     PICKUP: Pickup fulfillment. The customer picks up the order from the restaurant.
         -     DELIVERY: Delivery fulfillment. The restaurant, or a representative, delivers the order to the customer.
     - name: dates | type: array<Date> | description: Available dates in descending order, latest first.  Contains all dates that have at least one available time slot for this fulfillment type.  | validation: minItems 1, maxItems 100
        - name: day | type: integer | description: The day of the month.  | validation: minimum 1, maximum 31
        - name: month | type: integer | description: The month of the year.  | validation: minimum 1, maximum 12
        - name: year | type: integer | description: The year of the date.  | validation: minimum 2023, maximum 2200


```

### Examples

### Calculate available dates in a date range
```javascript
import { operations } from "@wix/restaurants";

async function calculateAvailableDatesInRange() {
  const response = await operations.calculateAvailableDatesInRange(
    "48605ac5-53fc-49b4-96b2-87f7636f5ce0",
    {
      from: {
        year: 2025,
        month: 12,
        day: 20
      },
      until: {
        year: 2025,
        month: 12,
        day: 26
      }
    },
  );
}

/* Promise resolves to:
 * {
 *   "availableDatesPerFulfillmentType": [
 *     {
 *       "fulfilmentType": "PICKUP",
 *       "dates": [
 *         {
 *           "year": 2025,
 *           "month": 12,
 *           "day": 24
 *         },
 *         {
 *           "year": 2025,
 *           "month": 12,
 *           "day": 23
 *         },
 *         {
 *           "year": 2025,
 *           "month": 12,
 *           "day": 22
 *         }
 *       ]
 *     },
 *     {
 *       "fulfilmentType": "DELIVERY",
 *       "dates": [
 *         {
 *           "year": 2025,
 *           "month": 12,
 *           "day": 24
 *         },
 *         {
 *           "year": 2025,
 *           "month": 12,
 *           "day": 23
 *         },
 *         {
 *           "year": 2025,
 *           "month": 12,
 *           "day": 22
 *         }
 *       ]
 *     }
 *   ]
 * }
 */

```

### calculateAvailableDatesInRange (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { operations } from '@wix/restaurants';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { operations },
  // Include the auth strategy and host as relevant
});


async function calculateAvailableDatesInRange(operationId,options) {
  const response = await myWixClient.operations.calculateAvailableDatesInRange(operationId,options);
};
```

---