moment check if one date is greater in one day from another date code example
Example 1: moment js check if date is greater than
let A = moment('2020-01-02');
let B = moment('2020-01-01');
let C = moment('2020-01-03');
console.log(A.diff(B, 'days'));
console.log(A.diff(C, 'days'));
Example 2: moment check greater than current time
function check() {
var now = moment();
var hourToCheck = (now.day() !== 0)?17:15;
var dateToCheck = now.hour(hourToCheck).minute(30);
return moment().isAfter(dateToCheck);
}
console.log(check())