How to calculate date and change format date : How to calculate date and change format date.
I can't compare date code below. I want to know why help me please i want example compare date or calculate day results of different days

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

    <script>
    var d = new Date();
    var curr_date = d.getDate();
    var curr_month = d.getMonth() + 1;
    var curr_year = d.getFullYear();
    var d1 = curr_date + "/" + curr_month + "/" + curr_year;
    //alert(d1); change format date completed 12/04/2019

    var date2 = new Date("04/12/2018"); 
    var curr_date2 = date2.getDate();
    var curr_month2 = date2.getMonth() + 1; 
    var curr_year2 = date2.getFullYear();
    var d2 = curr_date2 + "/" + curr_month2 + "/" + curr_year2;
    //alert(d2); // change format date completed 12/04/2018

    if(d1 > d2) {
    	console.log("aaa");
    }else{
    	console.log("bbb");
    }
    </script>

<!-- end snippet -->

