Skip to content

Instantly share code, notes, and snippets.

@jrhorn424 jrhorn424/age.js forked from gaand/age.js
Created Oct 6, 2015

What would you like to do?
var age = function age() {
var dob = new Date(this.dob);
var today = new Date();
var thisYear = today.getFullYear();
if (dob.getMonth() > today.getMonth() ||
dob.getMonth() === today.getMonth() &&
dob.getDate() >= today.getDate()) {
thisYear -= 1;
return thisYear - dob.getFullYear();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.