mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 09:25:45 +01:00
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.
This commit is contained in:
@@ -539,7 +539,7 @@ var fs = require('fs'),
|
|||||||
if (!data.birthday) {
|
if (!data.birthday) {
|
||||||
data.age = '';
|
data.age = '';
|
||||||
} else {
|
} 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() {
|
function canSeeEmail() {
|
||||||
|
|||||||
Reference in New Issue
Block a user