actually make this display the accurate age

This commit is contained in:
Ellpeck 2018-07-25 02:08:49 +02:00
parent ee665ea86d
commit 2db7c6a96a

View file

@ -50,7 +50,8 @@ for (question of questions) {
$('#about-list').html(a);
function getAge() {
let birthdate = new Date("1999-05-21");
let age = new Date(Date.now()).getUTCFullYear() - birthdate.getUTCFullYear();
return age;
let birthdayMillis = Date.UTC(1999, 05, 21);
let todayMillis = Date.now();
let ageSinceStart = new Date(todayMillis - birthdayMillis);
return ageSinceStart.getUTCFullYear() - 1970;
}