function birthDateToAge(birthDate) { birthDate = new Date(birthDate); var now = new Date(), age = now.getFullYear() - birthDate.getFullYear(); return now.setFullYear(1972) < birthDate.setFullYear(1972) ? age - 1 : age; }