I would like to calculate my Contacts age based on his birthday. With some search I came up with this code:
(add code to Edit.js)
/*** Function to calculate Age based on birthday field change*/
jQuery('[name="birthday"]',form).change(function() {
var dateBirth = Vtiger_Helper_Js.getDateInstance(jQuery('[name="birthday"]',form).val(),jQuery('[name="birthday"]',form).attr("data-date-format"));
jQuery('[name="cf_755"]',form).val( Math.floor((Date.now()-dateBirth) / (31557600000)));
});
It doesn't work as it is and apart from that, it would change the age of the contact only on updating the birthday field. How to make this code work when any field has been updated?
Even better would be a real-time calculation of the age of the contact when the contact's page has been opened i.e. in detail view.
Any help is much appreciated!