Skip to content

Instantly share code, notes, and snippets.

@aaronpowell
Created July 14, 2014 02:05
Show Gist options
  • Save aaronpowell/5c24c60c2be54a9b1055 to your computer and use it in GitHub Desktop.
Save aaronpowell/5c24c60c2be54a9b1055 to your computer and use it in GitHub Desktop.
Parse an Octopus deployment and determine duration of each step
var dateItems = [].slice.call(document.querySelectorAll('.log-date span'));
var dates = dateItems.map(function (item) {
return { span: item, date: Date.parse(item.getAttribute('title')) };
}).map(function (item, index, arr) {
var next = arr[index + 1] || item;
return {
span: item.span,
date: item.date,
next: next
};
}).map(function (item) {
return 'Took ' + moment(item.next.date).diff(item.date, 'seconds') + 's';
});
console.log(dates);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment