Calculate age between two dates

@Leo That is more or less what I am needing, to be able to create an Input to be able to induce the dates each time the button is pressed, and see the result on the screen.

Function OnClick(ByRef ClickData) {
    var date1 = new Date(1978, 01 -1 , 27);
    var date2 = new Date(2023, 08 - 1, 10);

    var diff = date2 - date1;
	
	var years = date2.getFullYear() - date1.getFullYear();
	var months = date2.Month() - date1.getMonth();
	var days = date2.getDay() - date1.getDay();

    var age = "(" + years + "a " + months + "m " + years + "d)";

    return "The age is" + age;
}