I am facing one issue. I need to compare the given date with the today date using Javascript. I am explaining my code below.
function getCurrentDate(){
    var today = new Date();
    var dd = today.getDate();
    var mm = today.getMonth()+1; 
    var yyyy = today.getFullYear();
    if(dd<10) 
    {
        dd='0'+dd;
    } 
    if(mm<10) 
    {
        mm='0'+mm;
    } 
    today = dd+'-'+mm+'-'+yyyy;
    return today;
}
var givendate=new Date('19-01-2018');
var todaydate=$scope.getCurrentDate();
if (givendate >= todaydate) {
    console.log('bool',true);
}else{
    console.log('bool',false);
}
Here I should get the result true but here I am getting the console message as false. Please help me to resolve this issue.
 
     
     
    