moment js check if string can be a date code example
Example 1: moment check valid date
var date = moment("2016-10-19");
var check = date.isValid();
console.log(check);
Example 2: 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'));// => 1
console.log(A.diff(C, 'days'));// => -1