Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cf84c09a
Commit
cf84c09a
authored
Jan 09, 2017
by
Regis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format duration in vue: time_ago computed property in a dynamic fashion
parent
6625f479
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
app/assets/javascripts/vue_pipelines_index/time_ago.js.es6
app/assets/javascripts/vue_pipelines_index/time_ago.js.es6
+11
-2
No files found.
app/assets/javascripts/vue_pipelines_index/time_ago.js.es6
View file @
cf84c09a
...
...
@@ -31,8 +31,17 @@
},
duration() {
const { duration } = this.pipeline.details;
if (duration === 0) return '00:00:00';
if (duration !== null) return duration;
const date = new Date(duration * 1000);
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;
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment