Skip to content

Instantly share code, notes, and snippets.

@bwinton
Created December 11, 2012 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwinton/4260457 to your computer and use it in GitHub Desktop.
Save bwinton/4260457 to your computer and use it in GitHub Desktop.
update the time every 5 seconds.
var line;
var future = new Date(Date.parse("06 Jan 2013 09:00:00 GMT-0500")); // XXX PST vs PDT?
var past = new Date(Date.parse("30 Nov 2012 09:00:00 GMT-0500"));
line = document.querySelector(".orange");
setTimelineChars(line, future);
function setCurrent() {
var current = new Date();
line = document.querySelector(".green");
setTimelineChars(line, current);
}
setCurrent();
setInterval(setCurrent, 5000);
line = document.querySelector(".yellow");
setTimelineChars(line, past);
console.log("Done! Great Scott!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment