Calculate End of Finanical Year age based on DOB
<p>I'm trying to get an age based on the end of the financial year.
If my date of birth is the 16th Jan 1962 my current age is 50 (assuming today's date is the 16th Jan 2012). What javascript formula/function could I use to calculate the age at the end of the current financial year (ie. 30th June 2012)?</p>

<p>This is what I have to get the current age:</p>

<pre><code>function getAge(dateString) { 
    var today = new Date(); 
    var birthDate = new Date(dateString); 
    var age = today.getFullYear() - birthDate.getFullYear(); 
    var m = today.getMonth() - birthDate.getMonth(); 

    if (m &lt; 0 || (m === 0 &amp;&amp; today.getDate() &lt; birthDate.getDate())) { 
        age--; 
    } 

    alert("current age "+age) 
}
</code></pre>
