diff --git a/index.html b/index.html index 1355ab8..7e30fad 100644 --- a/index.html +++ b/index.html @@ -166,8 +166,8 @@ input[type=file]{display:none} > - - + +
@@ -395,6 +395,17 @@ function registerProfile() { loginProfile(profile.id); } +function calcAge() { + const b = document.getElementById('regBirth').value; + if (!b) return; + const birth = new Date(b); + const today = new Date(); + let age = today.getFullYear() - birth.getFullYear(); + const m = today.getMonth() - birth.getMonth(); + if (m < 0 || (m === 0 && today.getDate() < birth.getDate())) age--; + document.getElementById('regAge').value = age; +} + function previewRegPhoto() { const f = document.getElementById('regPhoto').files[0]; if (!f) return;