From 1f5dd1a0232e342b770def55b2b5eae3d0b67579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Garc=C3=ADa=20Crespo?= Date: Thu, 23 Jan 2020 10:50:45 -0800 Subject: [PATCH] ui: show accurate duration --- ui/package.json | 2 ++ ui/src/views/CollectionShow.vue | 3 ++- ui/yarn.lock | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ui/package.json b/ui/package.json index c49a94d4..3aee2193 100644 --- a/ui/package.json +++ b/ui/package.json @@ -9,11 +9,13 @@ "lint": "vue-cli-service lint" }, "dependencies": { + "@types/humanize-duration": "^3.18.0", "@types/validator": "^12.0.1", "@types/vue-moment": "^4.0.0", "bootstrap": "^4.3.1", "bootstrap-vue": "^2.0.3", "core-js": "^3.3.2", + "humanize-duration": "^3.21.0", "validator": "^12.1.0", "vue": "^2.6.10", "vue-class-component": "^7.0.2", diff --git a/ui/src/views/CollectionShow.vue b/ui/src/views/CollectionShow.vue index a7b211af..6ac35b17 100644 --- a/ui/src/views/CollectionShow.vue +++ b/ui/src/views/CollectionShow.vue @@ -107,6 +107,7 @@ import { namespace } from 'vuex-class'; import * as CollectionStore from '../store/collection'; import CollectionStatusBadge from '@/components/CollectionStatusBadge.vue'; import moment from 'moment'; +import humanizeDuration from 'humanize-duration'; import { api, EnduroCollectionClient } from '../client'; @@ -127,7 +128,7 @@ export default class CollectionShow extends Vue { private took(created: Date, completed: Date): string { const diff = moment(completed).diff(created); - return moment.duration(diff).humanize(); + return humanizeDuration(moment.duration(diff).asMilliseconds()); } private retry(id: string): Promise { diff --git a/ui/yarn.lock b/ui/yarn.lock index 4dd5bfc5..76ccdb6a 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -990,6 +990,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/humanize-duration@^3.18.0": + version "3.18.0" + resolved "https://registry.yarnpkg.com/@types/humanize-duration/-/humanize-duration-3.18.0.tgz#1de456980ff537a17cd62447f3d128bb57198d5a" + integrity sha512-11QHl+GvEQ5TlCjA9xqQKNv4S0P8XFq5uHeZe2UPjngESBl7tA1tai/60eEYwWMFWIyQOl7ybarYF0B33K3Qtg== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -4652,6 +4657,11 @@ human-signals@^1.1.1: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== +humanize-duration@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/humanize-duration/-/humanize-duration-3.21.0.tgz#ae5dc7e67640770cbf6a8d03a5d1138d47c7ce38" + integrity sha512-7BLsrQZ2nMGeakmGDUl1pDne6/7iAdvwf1RtDLCOPHNFIHjkOVW7lcu7xHkIM9HhZAlSSO5crhC1dHvtl4dIQw== + iconv-lite@0.4.24, iconv-lite@^0.4.4: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"