TypeError: date.getFullYear is not a function

I’m getting this error in this function

for(var row=0; row<data.length; row++){
   
    var d1 = new Date();
    Utilities.sleep(100);
    var d2 = new Date();
    console.log(d1);
    console.log(d2);  // Notice in console log they look alike but are different by 100 msec.
    console.log( d1.valueOf() === d2.valueOf() );
    function removeTime(date) {
      return new Date(date.getFullYear(),date.getMonth(),date.getDate());
    }
    data[row][17] = removeTime(data[row][17]);
    d1 = removeTime(d1);
    console.log(d1);
    console.log(data[row][17]);
    console.log(  );
    if(d1.valueOf() === data[row][17].valueOf()){
        Logger.log(" I'm in!")
          ss.getRange('B3:AA').setValue(data[row]);
      }
  }

where data includes big number of data and column 17 has the dates

here is a picture of column 17

enter image description here

and this is what i get when i render it

enter image description here

  • there are more dates.

been struggling with this for too long, so would really appreciate the help.