Need correction or suggestion over javascript that calculate difference in between two dates
<h3>Age Calculations</h3>

<p>I collect this JavaScript from many website; I would like to get age in between two different dates;<br />
in this script or example I’m looking to show my daughter <strong>age</strong>;; Everything goes fine <em> until her age passes 6 month</em>,<br /><br />
The script rounds the age to the upper number which is 
<strong>(ONE year in this case)</strong> , and 
round down the month which shows months digit in minus.<br /><br />
Well, I would like the script to view years rounded to the lower number if it’s<em><strong> less than 365 days</strong></em>,
and months to be <strong><em>rounded up since the days less than 365 days</em></strong>.</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-html lang-html prettyprint-override"><code>&lt;!-- Calculate Age --&gt;
&lt;script type="text/javascript"&gt;
var s = '2016-01-31T17:17:28.593Z';
var a = s.split(/[^0-9]/);
var d=new Date (a[0],a[1]-1,a[2],a[3],a[4],a[5] );
var fromDate = new Date(d);
var toDate = new Date();

// current date format as mm-dd-yyyy 
    var Start_Date = new Date(d);
    var sec = Start_Date.getSeconds();
    var min = Start_Date.getMinutes();
    var hr = Start_Date.getHours();
    var dd = Start_Date.getDate();
    var mm = Start_Date.getMonth()+1; //January is 0!
    var yyyy = Start_Date.getFullYear();
 if(dd&lt;10){
   dd='0'+dd
  } 
 if(mm&lt;10){
   mm='0'+mm
  }
 if(hr&lt;10){
   hr='0'+hr
  }
 if(min&lt;10){
   min='0'+min
  }
var Start_Date = dd+'-'+mm+'-'+yyyy+'&amp;nbsp at &lt;span style="direction:ltr; color:red ;font-weight:700;"&gt;[&amp;nbsp'+hr+ ":" +min+ ":" +sec+'&amp;nbsp]&lt;/span&gt;';
// End date format as mm-dd-yyyy
// Start_Date = str;
var differenceTravel = toDate.getTime() - fromDate.getTime();
// var months = Math.ceil (toDate.getMonth() - fromDate.getMonth() + (12 * (toDate.getFullYear() - 
// 1 day = 86400000,
var Tyears = Math.round(differenceTravel/1000/60/60/24/365);
var Tmonths = Math.round((differenceTravel - (Tyears * 365*60*60*24*1000)) / (1000*60*60*24*30));
var Tdays = Math.round((differenceTravel - (Tyears *60*60*24*365*1000) - (Tmonths *60*60*24*30*1000))/ (86400000));
//
document.writeln('&lt;div style="color:Blue"&gt;');
document.writeln('&lt;ul&gt;');
document.writeln('&lt;li&gt;&lt;span style="color:Navy"&gt;Seba Birthday:&amp;nbsp;&lt;/span&gt; ' + Start_Date +'&lt;/li&gt;');
document.write('&lt;li&gt;&lt;span style="color:MediumVioletRed"&gt;Her age is:&lt;/span&gt;&amp;nbsp; '+ Tyears +'&lt;span style="color:Green"&gt;&amp;nbsp;year &amp;nbsp; and &amp;nbsp; &lt;/span&gt;'+ Tmonths +'&lt;span style="color:Green"&gt;&amp;nbsp;months &amp;nbsp; and &amp;nbsp;&lt;/span&gt;'+ Tdays +'&lt;span style="color:Green"&gt;&amp;nbsp;days&lt;/span&gt;&lt;/li&gt;');
document.writeln('&lt;/ul&gt;&lt;/div&gt;');
&lt;/script&gt;
&lt;!-- / good --&gt;</code></pre>
</div>
</div>
</p>