Need to compare two dates in the following formats
a) Date1 - 01 Feb 2019 and second is
b) Date2 - 2/3/2017
I need to ensure that they cater to invalid dates and Date1 > date 2
function ValidateDates()
{
var Date1 =" 01 Feb 2019";
var Date2 ="2/3/2017";
if(new Date(Date1) > new Date(Date2))
{
console.log("Date1 is greater");
}
}
I am not looking for a script library like moment . Just want a JavaScript solution.