The following is meant to compare a Date of Birth and confirm the individual is 10 years old or greater. It appears to work, however I want some advice to improve or ensure my logic is correct for my date comparison within Selenium IDE. Do I need to use Date.parse() to turn these to milliseconds as per this advice or will these proper date formats be sufficient to compare them accurately?
<tr>
<td>storeEval</td>
<td>new Date("${DateOfBirthYear}","${DateOfBirthMonth}"-1,"${DateOfBirthDay}");</td>
<td>DateOfBirthAsDate</td>
</tr>
<tr>
<td>storeEval</td>
<td>new Date();</td>
<td>today</td>
</tr>
<tr>
<td>storeEval</td>
<td>(Date.prototype.addMonth = function(month) { var dat = new Date(this.valueOf()); dat.setMonth(dat.getMonth() + month); return dat; }); var dat = storedVars['today'];dat.addMonth(-120)</td>
<td>DateOfBirthEleven</td>
</tr>
<tr>
<td>storeEval</td>
<td>(storedVars['DateOfBirthEleven'] < storedVars['DateOfBirthAsDate'] ) ? true : false</td>
<td>AgeOK</td>
</tr>
Advice and suggestions welcome.