Here is my code, as taken from here: Calculate age in JavaScript
var today = new Date();
birthday_val = $(".datepicker").val().split('/'); // input value
birthday = new Date(birthday_val[2],birthday_val[1],birthday_val[0]); // birthday date object
var age = today.getFullYear() - birthday.getFullYear();
var m = today.getMonth() - birthday.getMonth();
var d = today.getDay() - birthday.getDay();
if (m < 0 || (m === 0 && today.getDate() < birthday.getDate()) ) {
age--;
}
It calculates it right except for the day - doesnt take this into account and I cant figure out why. Any takers?