Calculate age based on days instead of years

Calculating the age based on the year only caused issues in the display of the age because it was off. Example: Person who was born in march of 1999 is displayed as 15 instead of 14 after the turn of the year.
v1.18.x
cmastudios 11 years ago
parent 449adfae59
commit e3185b9560

@ -539,7 +539,7 @@ var fs = require('fs'),
if (!data.birthday) {
data.age = '';
} else {
data.age = new Date().getFullYear() - new Date(data.birthday).getFullYear();
data.age = Math.floor((new Date().getTime() - new Date(data.birthday).getTime()) / 31536000000);
}
function canSeeEmail() {
@ -581,4 +581,4 @@ var fs = require('fs'),
};
}(exports));
}(exports));

Loading…
Cancel
Save