title: How to calculate age from jquery datepicker?
body: <p>I want to calculate age when date is selected by using jquery date picker. I added code below but it showing minus value if i select date like '19/03/2015','15/01/2015' or '19/03/2014' ,'31/12/2014'</p>
  
  <pre><code>  $(document).ready(function () 
  {
   console.log($(document).width());           
       $('#patientDob').datepicker
      ({
          dateFormat: 'dd/mm/yy',
          changeMonth: true,
          changeYear: true,
          yearRange: '1900:2150',
          maxDate: new Date(),
          inline: true,
  
               onSelect: function() {
                 var birthDay = document.getElementById("patientDob").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('patientAge').value = age;
              }
       });  
  
  });
  </code></pre>