javascript check if two dates are equal code example

Example 1: 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

Example 2: string compare on date in js

var d1 = Date.parse("2012-11-01");
var d2 = Date.parse("2012-11-04");
if (d1 < d2) {
    alert ("Error!");
}

Example 3: check if date equal js

...mapActions({
   startRefreshTokenWatcher: sharedTypes.REFRESH_TOKEN_WATCHER,
   stopRefreshTokenWatcher: sharedTypes.STOP_REFRESH_TOKEN_WATCHER
})