The code below calculates the age of a person in years, how would the calculation in days?
var ctrlAge = Runner.getControl(pageid, 'age_field');
var ctrlDate = Runner.getControl(pageid, 'date_of_birth');
now = new Date();
function func() {
var dateofbirth=new Date(ctrlDate.getValue());
var age=now.getFullYear()-dateofbirth.getFullYear();
if (now.getMonth()<dateofbirth.getMonth()) {
age=age-1;
}
ctrlAge.setValue(age);
};
ctrlAge.on('click', func);