📜  如何在打字稿代码示例中比较两个日期

📅  最后修改于: 2022-03-11 14:48:36.339000             🧑  作者: Mango

代码示例1
for(let k = 0; k < this.bookingDetailsArrayRealObject.length; k++){
        let dateCheckOut = this.bookingDetailsArrayRealObject[k].package.chackout;
        let dateToBeCheckOut = new Date(dateCheckOut);
        let today = new Date();
        //let today_test = new Date();
        if(this.bookingDetailsArrayRealObject[k].status){
          if(dateToBeCheckOut < today){
            this.bookingIdsToBeUpdated.push(this.bookingDetailsArrayRealObject[k]._id);
            window.alert('true');
            console.log(today.toDateString());
            console.log(dateToBeCheckOut.toDateString());
            console.log(this.bookingDetailsArrayRealObject[k]);
          }
        }
      }