Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1404417 - Don't show negative durations, they are always due to client clock skew #1034

Merged
merged 1 commit into from
Dec 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/scripts/filters/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,9 @@ angular.module('openshiftConsole')
var minutes = duration.minutes();
var seconds = duration.seconds();

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

if (hours) {
Expand Down
2 changes: 1 addition & 1 deletion dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13168,7 +13168,7 @@ return b ? (c = c || new Date(), a(moment(c).diff(b))) :b;
} ]).filter("timeOnlyDuration", function() {
return function(a) {
var b = [], c = moment.duration(a), d = Math.floor(c.asHours()), e = c.minutes(), f = c.seconds();
return d || e || f ? (d && b.push(d + "h"), e && b.push(e + "m"), d || b.push(f + "s"), b.join(" ")) :"";
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(" ");
};
}), angular.module("openshiftConsole").filter("uid", function() {
return function(a) {
Expand Down