how to get the number of days between the current date and the date supplied jquery
<p>I want to calculate the number of days between the date provided and the current date.
I am using the following javascript, but i am getting wrong results.</p>

<pre><code>function getcabin(saildates) {
    var d = new Date();

    var month = d.getMonth()+1;
    var day = d.getDate();

    var output = d.getFullYear() + '-' + month + '-' + day;
    alert(daydiff(parseDate(output), parseDate(saildates)));
}
function parseDate(str) {
    var mdy = str.split('-')
    return new Date(mdy[2], mdy[0]-1, mdy[1]);
}

function daydiff(first, second) {
    return (second-first)/(1000*60*60*24)
}
</code></pre>

<p>Can anyone please point out the mistake or how to do it?</p>
