title: How do I get age in years, months and days by auto populating my form?
body: <p>I want to auto fill my age in my form using a date-picker. It should populate the age in the form automatically when I put the birthday on the birth date form using date-picker then it will auto determine its age. For example my birthday is 10/17/1996 and today is 7/30/2017 so the form will auto populate like this:
  20 years 9 months 13 days.</p>
  
  <pre><code>&lt;!--html form--&gt;
  &lt;input type="date" name="birthday"&gt; 10/17/1996
  &lt;input type="text" name="Years"&gt; 20 years
  &lt;input type="text" name="m"&gt; 9 months
  &lt;input type="text" name="d"&gt; 13 days
  
  &lt;!--script right here--&gt;
  function getAge(dateString) {
      var today = new Date();
      var birthDate = new Date(dateString);
      var Years = today.getFullYear() - birthDate.getFullYear();
      var m = today.getMonth() - birthDate.getMonth();
      if (m &lt; 0 || (m === 0 &amp;&amp; today.getDate() &lt; birthDate.getDate())) {
          Years--;
      }
      return Years;
  }
  </code></pre>