Good day,
I need help in solving this problem
Problem :
I am trying to set up a custom script that calculates the age of the user base on the year it's chosen, Also when the user inputs the first_name , last_name , middle_name it should reflect on full_name.
I tried my best to code it but it's not working, to anyone who is reading this with a golden heart, please help me correct my code.
Addition note: I am using a Frappe framework and running on Ubuntu 18.04.5 LTS
For additional info on where I create custom code and the doctype (client_details)
Screenshots: https://drive.google.com/drive/folders/1556W7AeeLfaJuC2Fu8RbnI7sSZc4hXQZ?usp=sharing
Thank you so much <3
//my custom code using I'm writing on .js
frappe.ui.form.on('client_details', {
refresh: function(frm) {
var today = new Date();
var birthDate = new Date(brith_day);
var age = today.getFullYear() - birthDate.getFullYear(); var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
} return age;
}
refresh: function(frm){
var first_name = first_name
var last_name = last_name
var full_name = first_name.concat(last_name)
return full_name;
}
});