Get an array of date values from dataset, and based on the values, filter a date array, to get the ones available

Yeah, no worry, I saw that. This is the code that I came up with.
Using repeaters.

function getDates(startDate, stopDate) {
 var dateArray = [];
 var currentDate = $w("#datePickerFrom").value;
 var stopDate = $w("#datePickerTo").value;
 while (currentDate <= stopDate) {
        dateArray.push( moment(currentDate).format('YYYY-MM-DD') )
        currentDate = moment(currentDate).add(1, 'days');
 }
 

    console.log(dateArray);
 return dateArray;
}


//This function does the search and treats it
async function createSearch(startDate, endDate) {
 let rentalDates = createDateArray(startDate, endDate)
 let search = await queryCollection("VVaunut", "aikavali", rentalDates)
 if (search.items.length > 0) {
let searchItems = search.items
$w("#repeaterAvailableRentals").data = searchItems;
 return searchItems
 }
 return "No rental available!"
}

export function btnSave_click(event, $w) {

 createSearch($w("#datePickerFrom").value, $w("#datePickerTo").value)


}


//This is a function to query the collection.
async function queryCollection(collection, field, array) {
 let query = await wixData
 .query(collection)
 .not(wixData.query(collection).hasSome(field, array))
 .find()
 .then(result => result)
 return query
}

//This function creates the Date Array
function createDateArray(start, end) {
 let dateArray = []
  start = moment(start)
  end = moment(end)
 while (start <= end) {
    dateArray.push(start.format("YYYY-MM-DD"))
    start = moment(start).add(1, "days")
 }
 return dateArray
}

Thanks a lot for your help! <3
-A