This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Returns a list of time slots at a specified reservation location on a specified date
, and their availability for a specified partySize
.
Without passing optional parameters, the list will contain a single time slot at the specified date
.
Use slotsBefore
and slotsAfter
to get additional time slots before and after the specified date
.
If you do not provide a duration
, the duration will be calculated automatically based on the reservation location's configuration.
The reservation location's settings used to determine the duration are its defaultTurnoverTime
and turnoverTimeRules
. These specify how much time should be allotted for a reservation of a party of a specified size.
The interval between startDate
s of time slots in the response is determined by the reservation location's timeSlotInterval
. This interval is not affected by the duration
provided.
function getTimeSlots(
reservationLocationId: string,
date: Date,
partySize: number,
options: GetTimeSlotsOptions,
): Promise<GetTimeSlotsResponse>;
ID of the reservation location for which to retrieve time slots.
Date and time for which to retrieve a time slot in ISO 8601 format.
Size of the party that needs to be seated during this time slot.
Min: 1
Options for retrieving the time slots.
import { timeSlots } from "@wix/table-reservations";
/* Sample reservationLocationId value: 'fab8cc1f-31cf-462f-b5bb-392594624bf2'
* Sample date value: new Date("2023-12-29T12:30:00Z")
* Sample partySize value: 2
*/
timeSlots
.getTimeSlots(
reservationLocationId,
new Date("2023-12-29T12:30:00Z"),
partySize,
)
.then((retrievedSlots) => {
const firstStartDate = retrievedSlots.timeSlots[0].startDate;
const firstStatus = retrievedSlots.timeSlots[0].status;
console.log("Success! Retrieved the following time slots:", retrievedSlots);
return retrievedSlots;
})
.catch((error) => {
console.error(error);
// Handle the error
});
/* Promise resolves to:
* {
* "timeSlots": [
* {
* "startDate": "2023-12-29T10:00:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T10:15:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T10:30:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T10:45:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T11:00:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T11:15:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T11:30:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T11:45:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T12:00:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T12:15:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T12:30:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T12:45:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T13:00:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T13:15:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T13:30:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T13:45:00.000Z",
* "duration": 90,
* "status": "UNAVAILABLE",
* "tableCombinations": [],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T14:00:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T14:15:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T14:30:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T14:45:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* },
* {
* "startDate": "2023-12-29T15:00:00.000Z",
* "duration": 90,
* "status": "AVAILABLE",
* "tableCombinations": [
* {
* "tableIds": [
* "1ed802ae-708f-4da6-9177-54c3df5d3dd5"
* ]
* }
* ],
* "manualApproval": false
* }
* ]
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.