diff --git a/README.md b/README.md index e1e322e..395124b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # CountDown This is a Simple count down timer made via Javascript -I am Fixing the Readme \ No newline at end of file +I am Fixing the Readme. +Every year the countdown will reset at midnight of 31st dec. diff --git a/script.js b/script.js index f4b1ce6..7879134 100644 --- a/script.js +++ b/script.js @@ -7,7 +7,10 @@ let secEl = document.getElementById('sec'); function countdown(){ var currentTime= new Date().getTime(); // Curent Time -const newYear = new Date("dec 31, 2021 23:59:59").getTime(); // destination time + +var year = new Date().getFullYear(); // gives us the current year +// ${year} adds the year variable automatically. +const newYear = new Date(`dec 31, ${year} 23:59:59`).getTime(); // destination time var difference = newYear - currentTime; // you have got the answere but in milliseconds @@ -33,9 +36,4 @@ function Timeformat (time) { } setInterval(countdown,1000) -// 1000ms = 1 sec - - - - - +// 1000ms = 1 sec diff --git a/style.css b/style.css index 80a1377..d7b9cd9 100644 --- a/style.css +++ b/style.css @@ -1,5 +1,6 @@ @import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;1,200&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@1,500&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Aboreto&display=swap'); @@ -11,17 +12,17 @@ body{ margin: 0px; background: url('bg1.jpg') no-repeat; - background-size: cover; + background-size: cover; /* background-position: center center; */ min-height: 100vh; font-family: 'Poppins', sans-serif; display: flex; flex-direction: column; align-items: center; - + } h1{ - + font-family: 'Aboreto', cursive; font-size: 4.2rem; font-weight: 400; margin-top: 5rem; @@ -33,13 +34,13 @@ h1{ .con{ display: flex; - /* border: 5px solid #ffffff9c; + /* border: 5px solid #ffffff9c; padding: 15px 70px ; */ } .big-text{ text-align: center; - font-size: 6rem; + font-size: 6rem; margin: 0px 60px; }