From abb1be365c62fe69ea36d199141bcf360992e196 Mon Sep 17 00:00:00 2001
From: Kai Reinhard <K.Reinhard@micromata.de>
Date: Sun, 10 Feb 2019 07:33:43 +0000
Subject: [PATCH] Fix in humanSeconds (seconds < 10).
---
borgbutler-webapp/src/utilities/global.js | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/borgbutler-webapp/src/utilities/global.js b/borgbutler-webapp/src/utilities/global.js
index 7539e71..7f122c0 100644
--- a/borgbutler-webapp/src/utilities/global.js
+++ b/borgbutler-webapp/src/utilities/global.js
@@ -58,9 +58,9 @@
export const humanSeconds = (secondsValue) => {
//var sec_num = parseInt(secondsValue, 10); // don't forget the second param
- var hours = Math.floor(secondsValue / 3600);
- var minutes = Math.floor((secondsValue - (hours * 3600)) / 60);
- var seconds = secondsValue - (hours * 3600) - (minutes * 60);
+ let hours = Math.floor(secondsValue / 3600);
+ let minutes = Math.floor((secondsValue - (hours * 3600)) / 60);
+ let seconds = secondsValue - (hours * 3600) - (minutes * 60);
if (hours < 10) {
hours = "0" + hours;
@@ -68,10 +68,8 @@
if (minutes < 10) {
minutes = "0" + minutes;
}
- if (seconds < 10) {
- seconds = "0" + seconds;
- }
- return hours + ':' + minutes + ':' + seconds.toLocaleString(undefined, {maximumFractionDigits: 0});
+ const secondsPrefix = seconds < 10 ? '0' : '';
+ return hours + ':' + minutes + ':' + secondsPrefix + seconds.toLocaleString(undefined, {maximumFractionDigits: 0});
}
export const revisedRandId = () => Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10);
--
Gitblit v1.10.0