Skip to content

Instantly share code, notes, and snippets.

@viki53
Created March 10, 2020 09:05
Show Gist options
  • Save viki53/16676fad3a58b0ad1302a4b861e1ddbe to your computer and use it in GitHub Desktop.
Save viki53/16676fad3a58b0ad1302a4b861e1ddbe to your computer and use it in GitHub Desktop.
input time to seconds
time = input.value; // Ex: '02:30:25'
seconds = time.split(':').reverse().reduce((t, s, i) => { return t + (Math.pow(60, i) * parseInt(s)) }, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment