Javascript Date() to calculate age not working by the days
<p>Here is my code, as taken from here: <a href="http://stackoverflow.com/questions/4060004/calculate-age-in-javascript">Calculate age in JavaScript</a></p>

<pre><code>        var today = new Date();
        birthday_val = $(".datepicker").val().split('/'); // input value
        birthday = new Date(birthday_val[2],birthday_val[1],birthday_val[0]); // birthday date object
        var age = today.getFullYear() - birthday.getFullYear();
        var m = today.getMonth() - birthday.getMonth();
        var d = today.getDay() - birthday.getDay();
        if (m &lt; 0 || (m === 0 &amp;&amp; today.getDate() &lt; birthday.getDate()) ) {
            age--;
        }
</code></pre>

<p>It calculates it right except for the day - doesnt take this into account and I cant figure out why. Any takers?</p>
