No available slot error when using createBooking with long duration

Hello,

I want to create a multi day booking(>30 days) through the api so first I fetch the available spots


export async function getAvailableSlots2(requestedServiceId, options = {}) {
    // Get the IDs of all the appointments that have been requested but are still pending approval.

    const queryAvailabilityObject = {
        filter: {
                serviceId: [requestedServiceId],
                startDate: options.startDateTime.toISOString(),
                endDate: options.endDateTime.toISOString()
            },
    }
    // Get all of the service's available slots during the given date range.
    let availableSlots = (await availabilityCalendar.queryAvailability(queryAvailabilityObject, options)).availabilityEntries;
    console.log('availableSlots:', availableSlots);
    // Return the filtered list.
    return availableSlots;
}

and then when I try to create a booking some of the slots work the other don’t despite having the staff available 24 hours.

 const booking = {
      tags: ["INDIVIDUAL"],

      bookedEntity: {
        slot: {
          startDate: selectedSlot.startDate,
          endDate: selectedSlot.endDate,
          location: {
            locationType: selectedSlot.location.locationType,
          },
          resource: {
            id: selectedSlot.resource._id,
          },
          scheduleId: selectedSlot.scheduleId,
          serviceId: selectedSlot.serviceId,
        },
      },

      totalParticipants: 1,
    };

If someone can help me fix this. I couldn’t find a pattern why this happens also when I set the duration to 1 month for example, the first available slot doesn’t start tomorrow but after some weeks. I don’t know why.

image
image