Date Difference in Javascript
<p>I am developing a system which requires that you should be at least 18 years old to register. </p>

<p>For doing this validation i have implemented date difference in javascript in following way, but it is not accurate, is there any javascript function or other way to do this?</p>

<pre><code>var d1=new Date(1985,1,28);
var d2=new Date();
var milli=d2-d1;
var milliPerYear=1000*60*60*24*365.26;
var years_old=milli/milliPerYear; 
</code></pre>
