javascript check if two date are ugual
const isSameDate = (dateA, dateB) => {
return dateA.toISOString() === dateB.toISOString();
};
const r = isSameDate(new Date(2010, 10, 20), new Date(2010, 10, 20));
console.log(r); //> true
javascript check if two date are ugual
const isSameDate = (dateA, dateB) => {
return dateA.toISOString() === dateB.toISOString();
};
const r = isSameDate(new Date(2010, 10, 20), new Date(2010, 10, 20));
console.log(r); //> true
compare dates in javascript
var date1 = new Date('December 25, 2017 01:30:00');
var date2 = new Date('June 18, 2016 02:30:00');
//best to use .getTime() to compare dates
if(date1.getTime() === date2.getTime()){
//same date
}
if(date1.getTime() > date2.getTime()){
//date 1 is newer
}
how to compare two date in typescript
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]);
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us