Date Filter in a Repeater

Hello guys, I want to show real estate ad in a last month. The system already give me a date as Created date. I want to show in my repeater last 1 month.

Dairelersatilik is my database name.

Thanks for help!

import wixData from ‘wix-data’ ;

$w.onReady( function () {

const firstDate = new Date( 2021 , 3 , 1 , 1 , 1 ) // month is zero-indexed so need to subtract 1
const secondDate = new Date( 2021 , 3 , 10 , 1 , 1 ) // month is zero-indexed so need to subtract 1

wixData.query( "DairelerSatilik" ) 
  .lt( "_createdDate" , firstDate)  // Dates are stored in a field with field key "date" 
  .or( 
    wixData.query( "DairelerSatilik" ) 
      .gt( "_createdDate" , secondDate) 
  ) 
  .find() 
  .then((results) => { 

if (results.items.length > 0 ) {
let items = results.items; // Filtered items to display
} else {
// handle case where no matching items found
}
})
. catch ((error) => {
console.log(error);
});
});

The following code should get you the results you want.

Note that the filter does not use an .or condition. The filter is:
_createdDate is greater than or equal to the beginDate AND _createdDate is less than the endDate .

import wixData from 'wix-data';

$w.onReady(function () {
 
   const beginDate = new Date(2021, 3, 1, 0, 0, 0) // first day of month
   const endDate = new Date(2021, 4, 1, 0, 0, 0) // first day of next month

   wixData.query("DairelerSatilik")
        .ge("_createdDate", beginDate)
        .lt("_createdDate", endDate)
        .find()
        .then((results) => {
           if (results.items.length > 0) {
              let items = results.items; // filtered items to display in repeater
              console.log('items', items);
           } else {
              // handle case where no matching items found
           }
       })
       .catch((error) => {
          console.log(error);
       });
});