-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
25 lines (20 loc) · 865 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// const timeContainer = document.getElementById("time-container");
// const BIRTH_DAY = "12-10-1815";
// const BIRTH_DAY_DATE = new Date(BIRTH_DAY);
// const intlNumberFormatter = new intl.NumberFormat("en-US");
// setInterval(() => {
// const now = new Date();
// const difference = Math.floor(
// (now.getTime() - BIRTH_DAY_DATE.getTime()) /1000
// );
// timeContainer.innerText = intlNumberFormatter.format(difference);
// }, 1000);
const timeContainer = document.getElementById("time-container");
const BIRTH_DAY = "12-10-1815";
const BIRTH_DAY_DATE = new Date(BIRTH_DAY);
const intlNumberFormatter = new Intl.NumberFormat("en-US");
setInterval(() => {
const now = new Date();
const difference = Math.floor((now.getTime() - BIRTH_DAY_DATE.getTime()) / 1000);
timeContainer.innerText = intlNumberFormatter.format(difference);
}, 1000);