Commit cf84c09a authored by Regis's avatar Regis

format duration in vue: time_ago computed property in a dynamic fashion

parent 6625f479
...@@ -31,8 +31,17 @@ ...@@ -31,8 +31,17 @@
}, },
duration() { duration() {
const { duration } = this.pipeline.details; const { duration } = this.pipeline.details;
if (duration === 0) return '00:00:00'; const date = new Date(duration * 1000);
if (duration !== null) return duration;
let hh = date.getUTCHours();
let mm = date.getUTCMinutes();
let ss = date.getSeconds();
if (hh < 10) hh = `0${hh}`;
if (mm < 10) mm = `0${mm}`;
if (ss < 10) ss = `0${ss}`;
if (duration !== null) return `${hh}:${mm}:${ss}`;
return false; return false;
}, },
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment