I have following script
Script
$('#test1').click(function () {
    // Here are the two dates to compare
    var date1 = '29-10-2015';
    var date2 = '29-12-2015';
    var Targetvalue = parseFloat("1000000");
    var dealjson = '[{"dealdate":"25-12-2015","cost":200000},{"dealdate":"25-11-2015","cost":200000}]';
    // First we split the values to arrays date1[0] is the year, [1] the month and [2] the day
    date1 = date1.split('-');
    date2 = date2.split('-');
    // Now we convert the array to a Date object, which has several helpful methods
    date1 = new Date(date1[2], date1[1] - 1, date1[0]);
    date2 = new Date(date2[2], date2[1] - 1, date2[0]);
    var deals = JSON.parse(dealjson);
    var achieved = 0;
    while (date1 <= date2) {
        var next_day = new Date(date1);
        next_day.setDate(date1.getDate() + 1);
        achieved = 0;
        deals.forEach(function (deal) {
            var dealDate = deal.dealdate;
            dealDate = dealDate.split('-');
            dealDate = new Date(dealDate[2], dealDate[1] - 1, dealDate[0]);
            if (dealDate === date1) console.log("matched" + date);
        });
        date1 = next_day;
    }
});
I am trying to log in the console if both the date in the loop matches the date from Json array dealjson  although I have two dates which falls in between the date1 and date 2 but still the match is not happening 
if (dealDate === date1) console.log("matched" + date);
Here is the FIDDLE
Can any one help me out where is the mistake
 
     
     
    