Created
February 18, 2022 18:54
-
-
Save thezacharytaylor/f23405e8648f8db444f411d354fb3a88 to your computer and use it in GitHub Desktop.
Countdown till Crimmus or any other date you want to use.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credit: https://www.w3resource.com/javascript-exercises/javascript-basic-exercise-9.php | |
today = new Date(); | |
let cmas = new Date(today.getFullYear(), 11, 25); | |
if (today.getMonth() == 11 && today.getDate() > 25) { | |
cmas.setFullYear(cmas.getFullYear() + 1); | |
} | |
let one_day = 1000 * 60 * 60 * 24; | |
console.log(Math.ceil((cmas.getTime() - today.getTime()) / (one_day)) + " days left until Christmas!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment