diff --git a/frontend/app/index.html b/frontend/app/index.html index 8c04e0f296..906973bfff 100644 --- a/frontend/app/index.html +++ b/frontend/app/index.html @@ -234,6 +234,7 @@ + diff --git a/frontend/app/scripts/filters/duration.js b/frontend/app/scripts/filters/duration.js new file mode 100644 index 0000000000..00e4b1f460 --- /dev/null +++ b/frontend/app/scripts/filters/duration.js @@ -0,0 +1,21 @@ +(function() { + 'use strict'; + + angular.module('theHiveFilters').filter('duration', function () { + return function (start, end) { + if (!start) { + return ''; + } + + if(end) { + // Compute duration between end and start + var duration = moment(end).diff(moment(start)); + + return moment.duration(duration, 'milliseconds').humanize(); + } else { + // Compute duration till now + return moment(start).fromNow(true); + } + }; + }); +})(); diff --git a/frontend/app/views/partials/case/case.list.html b/frontend/app/views/partials/case/case.list.html index b2bcec803c..386420dc95 100644 --- a/frontend/app/views/partials/case/case.list.html +++ b/frontend/app/views/partials/case/case.list.html @@ -99,9 +99,15 @@