Skip to content

Commit 43e511f

Browse files
author
OpenShift Bot
authored
Merge pull request #1034 from jwforres/no-negative-duration
Merged by openshift-bot
2 parents 848b794 + 9b35ca7 commit 43e511f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Diff for: app/scripts/filters/date.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ angular.module('openshiftConsole')
164164
var minutes = duration.minutes();
165165
var seconds = duration.seconds();
166166

167-
if (!hours && !minutes && !seconds) {
168-
return '';
167+
// If we have negative duration then normalize it to zero, don't show negative durations
168+
if (hours < 0 || minutes < 0 || seconds < 0) {
169+
hours = minutes = seconds = 0;
169170
}
170171

171172
if (hours) {

Diff for: dist/scripts/scripts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13168,7 +13168,7 @@ return b ? (c = c || new Date(), a(moment(c).diff(b))) :b;
1316813168
} ]).filter("timeOnlyDuration", function() {
1316913169
return function(a) {
1317013170
var b = [], c = moment.duration(a), d = Math.floor(c.asHours()), e = c.minutes(), f = c.seconds();
13171-
return d || e || f ? (d && b.push(d + "h"), e && b.push(e + "m"), d || b.push(f + "s"), b.join(" ")) :"";
13171+
return (d < 0 || e < 0 || f < 0) && (d = e = f = 0), d && b.push(d + "h"), e && b.push(e + "m"), d || b.push(f + "s"), b.join(" ");
1317213172
};
1317313173
}), angular.module("openshiftConsole").filter("uid", function() {
1317413174
return function(a) {

0 commit comments

Comments
 (0)