mirror of
https://github.com/hexahigh/080609.git
synced 2025-12-11 19:55:06 +01:00
fix
This commit is contained in:
parent
b7ac76d615
commit
7b9add13a3
@ -13,7 +13,10 @@
|
||||
<body>
|
||||
<div style="text-align: center;">
|
||||
<p>If you were born on the 8th of June 2009 you would be</p>
|
||||
<h3 id="age"></h3>
|
||||
<h3 id="ageYears"></h3>
|
||||
<h3 id="ageDays"></h3>
|
||||
<h3 id="ageHours"></h3>
|
||||
<h3 id="ageMinutes"></h3>
|
||||
<p>And your birthday would be in</p>
|
||||
<div id="countdown"></div>
|
||||
</div>
|
||||
|
||||
17
index.js
17
index.js
@ -4,10 +4,23 @@ function calculateYearsSince() {
|
||||
const diffInMs = Date.now() - myDate.getTime();
|
||||
const diffInYears = diffInMs / (1000 * 60 * 60 * 24 * 365.25);
|
||||
const days = Math.floor(diffInMs / (1000 * 60 * 60 * 24));
|
||||
const hours = Math.floor((diffInMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
const hours = Math.floor(hoursSince())
|
||||
//const hours = Math.floor((diffInMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||
const minutes = Math.floor((diffInMs % (1000 * 60 * 60)) / (1000 * 60));
|
||||
|
||||
document.getElementById("age").innerText = Math.floor(diffInYears) + " years, " + days + " days, " + hours + " hours and " + minutes + " minutes"
|
||||
document.getElementById("ageYears").innerText = Math.floor(diffInYears) + " years"
|
||||
document.getElementById("ageDays").innerText = days + " days"
|
||||
document.getElementById("ageHours").innerText = hours + " hours"
|
||||
document.getElementById("ageMinutes").innerText = minutes + " minutes"
|
||||
}
|
||||
|
||||
function hoursSince() {
|
||||
const myDate = new Date('2009-06-08');
|
||||
|
||||
const now = new Date();
|
||||
const diff = now - myDate;
|
||||
const hours = Math.floor(diff / 3.6e6);
|
||||
return hours;
|
||||
}
|
||||
|
||||
var year = 2023
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user