How to calculate age into years, month, day with js (using js ui datepicker)?
<p>I am very beginner in <strong>JS</strong>.I can calculate age in years with below code.This code is working perfectly for years calculation.If i put date after 12 <strong><em>(ex. 14/12/1950)</em></strong> of any month then its showing <strong>NaN</strong> Years.Now i want to display <em>Years,Months,Days</em> of age from anyone's given birthday.Could anyone help me with this? Thanks in advance.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function () 
{
 console.log($(document).width());           
     $('#datepicker').datepicker
    ({
        dateFormat: 'dd/mm/yy',
        changeMonth: true,
        changeYear: true,
        yearRange: '1900:2150',
        maxDate: new Date(),
        inline: true,

             onSelect: function() {
               var birthDay = document.getElementById("datepicker").value;
                var DOB = new Date(birthDay);
                var today = new Date();
                var age = today.getTime() - DOB.getTime();
                age = Math.floor(age / (1000 * 60 * 60 * 24 * 365.25));

                document.getElementById('agecal').innerText = age;
            }
     });  

});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
&lt;script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"&gt;&lt;/script&gt;
&lt;link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"&gt;
&lt;div class="form-group"&gt;
  &lt;label for="datepicker"&gt;Date of Birth: &lt;span style="color:red"&gt;*&lt;/span&gt;&lt;/label&gt;
  &lt;input type="text" id="datepicker" name="date_of_birth" class="form-control" placeholder="Insert your Date of Birth..."&gt;
&lt;/div&gt;
&lt;div class="form-group"&gt;
  &lt;label for="agecal"&gt;Age as On(&lt;?php echo date('d/m/Y'); ?&gt;): &lt;span id="agecal" style="background-color:#60ab59;padding: 0px 50px 0px 50px;color: white;font-weight: bold; border-radius: 5px;" &gt;0&lt;/span&gt;&lt;/label&gt;
&lt;/div&gt;</code></pre>
</div>
</div>
</p>