Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ltrebing/6b17b0648a4b36eb38b4f07f893bc991 to your computer and use it in GitHub Desktop.
Save ltrebing/6b17b0648a4b36eb38b4f07f893bc991 to your computer and use it in GitHub Desktop.
This simple js bookmark let you display the correct commit timestamp at github
javascript:(function() {
var relativeTimeElements = window.document.querySelectorAll("relative-time, time-ago, time.js-timeago");
function pad(n) {
return n < 10 ? '0' + n : n;
}
relativeTimeElements.forEach(function(timeElement) {
var d = new Date(timeElement.attributes.datetime.value);
timeElement.innerHTML =
d.getFullYear() + '-' +
pad(d.getMonth()) + '-' +
pad(d.getDay()) + ' ' +
pad(d.getHours()) + ':' +
pad(d.getMinutes()) + ':' +
pad(d.getSeconds());
})
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment