Last active
August 29, 2015 14:03
-
-
Save le717/0dd5b7c20ba880c08139 to your computer and use it in GitHub Desktop.
For Adventures in Website Design && Development – 6/26/14 (http://wp.me/p1V5ge-1zi)
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
function countDown() { | |
"use strict"; | |
var curDate = new Date(), | |
curYear = curDate.getUTCFullYear(); | |
var futureYear = curYear + 1, | |
futureMonth = 1, // UTC month value is zero-based | |
futureDay = 12; | |
// Format the date in a more readable form | |
var options = { | |
day : "numeric", | |
year : "numeric", | |
month : "long", | |
weekday: "long" | |
}; | |
var bridalExpo = new Date(futureYear, futureMonth, futureDay), | |
daysToGo = bridalExpo.getTime() - curDate.getTime(), | |
daysToBridalExpo = Math.ceil(daysToGo / (1000 * 60 * 60 * 24)); | |
var message = "Today is " + curDate.toLocaleString("en-US", options) + ". "; | |
message += "We have " + daysToBridalExpo + " days until the Midwest Bridal Expo."; | |
console.log(message); | |
} | |
countDown(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment