Looking to compare two dates with different formats:
a) Date1 - 01 Feb 2019
b) Date2 - 2/3/2017
It's important to account for invalid dates and ensure that Date1 is greater than Date2.
function CompareAndValidateDates()
{
var Date1 ="01 Feb 2019";
var Date2 ="2/3/2017";
if(new Date(Date1) > new Date(Date2))
{
console.log("Date1 is greater");
}
}
No usage of a script library like moment, just seeking a pure JavaScript solution.