I am aware this is done using a javascript library. Currently, the only examples I've found for CRM 2011 involve calculating the age in years only using this code:
function CalcAge()
{
var now = new Date(); //Todays Date
var birthday = Xrm.Page.getAttribute("birthdate").getValue(); //Get the Date of Birth value
var diff = now.getMonth() - birthday.getMonth(); //Check to see if Birthday has already passed
if (diff > -1) //If Birthday has already occurred
{
var bd1 = now.getFullYear() - birthday.getFullYear();
//set the age attribute
Xrm.Page.getAttribute("frc_age").setValue(bd1.toString());
}
else //If Birthday has not already occurred
{
var bd2 = now.getFullYear() - birthday.getFullYear() - 1;
Xrm.Page.getAttribute("frc_age").setValue(bd2.toString());
}
}
I need help implementing a similar function that also accounts for the months.
-Thank You