Skip to content

Instantly share code, notes, and snippets.

@NFodrea
Last active June 20, 2017 19:25
Show Gist options
  • Select an option

  • Save NFodrea/b1dcf3804bd8f6f22a73b96e823580cf to your computer and use it in GitHub Desktop.

Select an option

Save NFodrea/b1dcf3804bd8f6f22a73b96e823580cf to your computer and use it in GitHub Desktop.
Format Days Hours Seconds Minuets for countdown timer
getTimeUntill (deadline) {
let time = Date.parse(deadline) - Date.parse(new Date());
let seconds = Math.floor((time/1000) % 60);
let minuets = Math.floor((time/1000/60) % 60);
let hours = Math.floor(time / (1000*60*60) % 24);
let days = Math.floor(time / (1000*60*60*24));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment