Created
July 14, 2014 02:05
-
-
Save aaronpowell/5c24c60c2be54a9b1055 to your computer and use it in GitHub Desktop.
Parse an Octopus deployment and determine duration of each step
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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