Skip to content

Commit e295bcf

Browse files
authored
Use moment js for better duration display fmt. Fixes #1187 (#1188)
1 parent e11abd4 commit e295bcf

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/visualizers/widgets/ExecutionIndex/ExecutionIndexWidget.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
define([
55
'deepforge/viz/Utils',
66
'widgets/LineGraph/LineGraphWidget',
7+
'./lib/moment.min',
78
'text!./ExecTable.html',
89
'css!./styles/ExecutionIndexWidget.css'
910
], function (
1011
Utils,
1112
LineGraphWidget,
13+
moment,
1214
TableHtml
1315
) {
1416
'use strict';
@@ -173,17 +175,7 @@ define([
173175
};
174176

175177
ExecutionIndexWidget.prototype.getDurationText = function (duration) {
176-
var hours,
177-
min,
178-
sec;
179-
180-
sec = duration/1000;
181-
hours = Math.floor(sec/3600);
182-
sec = sec%3600;
183-
min = Math.floor(sec/60);
184-
sec = Math.floor(sec%60);
185-
186-
return `${hours}:${min}:${sec}`;
178+
return moment.duration(duration).humanize();
187179
};
188180

189181
ExecutionIndexWidget.prototype.updateTime = function (id, force) {

0 commit comments

Comments
 (0)