From 2db7c6a96a63453ffc1f9e878db0723d044ba59f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 25 Jul 2018 02:08:49 +0200 Subject: [PATCH] actually make this display the accurate age --- scripts/about.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/about.js b/scripts/about.js index cf699ae..d90b043 100644 --- a/scripts/about.js +++ b/scripts/about.js @@ -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; } \ No newline at end of file