This commit is contained in:
Karan 2021-11-25 19:58:56 +05:30 committed by GitHub
parent 6ca4865d93
commit 1437888823
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,23 +0,0 @@
const endDate = "Sept 1 2022";
update();
function update() {
const temp = countdown();
for (const property in temp) {
console.log(`${property}: ${temp[property]}`);
}
window.setTimeout(update, 1000);
}
function countdown() {
const total = Date.parse(endDate) - new Date();
const days = Math.floor(total / (1000 * 60 * 60 * 24));
const hrs = Math.floor((total / (1000 * 60 * 60)) % 24);
const mins = Math.floor((total / 1000 / 60) % 60);
const secs = Math.floor((total / 1000) % 60);
return {
total,
days,
hrs,
mins,
secs
};
}