Calculate date difference in jQuery
<p>The question is; there are 2 fields in my application, one is date (Field1) and second is a label (Field2). So, I want that when user selects a date in field 1, then field 2 should be automatically populated (current date - date from field 1).
Can anyone help on how to implement it.</p>

<p>I'm using jQuery to display date:</p>

<pre><code>// This displays the date dialog when user clicks on Field1
$('#Field1').click(function () {
    $('#Field1').simpleDatepicker();
});

// Tried following code but it didn't worked
$('#Field1').click(function () {
    $('#Field1').simpleDatepicker({
        onSelect: function () {
       $('#Field2').value(calculateDays($('#Field1').toString))
        }
    });
});

function calculateDays(dateString) {
    var today = new Date();
    var inputDate = new Date(dateString);
    var days = today - inputDate;
    return days;
};
</code></pre>

<p>This may look like pathetic code to some folks but I'm just a beginner, so any suggestions/comments are welcome.</p>

<p>Also please tell me if this can be done using html only and no need to go to jQuery. It is my understanding that the calculating days (difference between dates) code will go in jQuery since this needs to be fired after selecting date ('onSelect' event). Please correct if wrong.</p>
