finished age
Some checks failed
Web/pipeline/head There was a failure building this commit

This commit is contained in:
Ell 2021-07-09 02:05:03 +02:00
parent 6bde3c4ff8
commit ce25a49e61
2 changed files with 7 additions and 1 deletions

View file

@ -1,6 +1,6 @@
[{ [{
"q": "How old are you?", "q": "How old are you?",
"a": "I'm XXX years old. This automatically updates now, too, so I won't ever forget to update it again!" "a": "I'm <span id=\"age\"></span> years old. This automatically updates now, too, so I won't ever forget to update it again!"
}, },
{ {
"q": "Where are you from?", "q": "Where are you from?",

View file

@ -12,4 +12,10 @@
</p> </p>
{% endfor %} {% endfor %}
</div> </div>
<script>
let birthdayMillis = Date.UTC(1999, 5 - 1, 21);
let todayMillis = Date.now();
let ageSinceStart = new Date(todayMillis - birthdayMillis);
$("#age").html(ageSinceStart.getUTCFullYear() - 1970);
</script>
</div> </div>