Skip to content

Instantly share code, notes, and snippets.

@jtwalters
Created March 21, 2016 17:44
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 jtwalters/c1fb74660d5911619699 to your computer and use it in GitHub Desktop.
Save jtwalters/c1fb74660d5911619699 to your computer and use it in GitHub Desktop.
Normalize m:ss, mm:ss, etc., to h:mm:ss
$table.find('td:nth-child(7)').each(function () {
var value = this.innerHTML.trim(),
parts = value.split(':');
// convert mm:ss to hh:mm:ss
if (parts.length === 2) {
// zero-pad minutes
if (parts[0].length < 2) {
value = '0' + value;
}
this.innerHTML = '00:' + value;
// console.log('00:' + value);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment