-
Notifications
You must be signed in to change notification settings - Fork 625
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1257 Display case duration in case list
- Loading branch information
Showing
3 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
}; | ||
}); | ||
})(); |
This file contains 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