Jquery Age calculation on date
<p>Am I missing something in following jQuery code.</p>

<pre><code>var dob = $('#date').val();
if(dob != ''){
    var today = new Date();
    var dayDiff = Math.ceil(today - dob) / (1000 * 60 * 60 * 24 * 365);
    var age = parseInt(dayDiff);
    $('#age').html(age+' years old');
}
</code></pre>

<p>And I am getting pre fetched value of #date from MySQL db.</p>

<pre><code>&lt;input type="text" value="1988-04-07" id="#date" name="dob" /&gt;&lt;p id="age"&gt;&lt;/p&gt;
</code></pre>

<p>It's returning Nan, not correct value.</p>
