fix(simulator): handle close to zero duration formatting
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 8 Nov 2023 17:39:42 +0000 (18:39 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 8 Nov 2023 17:39:42 +0000 (18:39 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
pnpm-lock.yaml
src/utils/Utils.ts
ui/web/package.json
ui/web/pnpm-lock.yaml

index 7f248e8a119bb62464e6b95f12051180c80ce479..cc83468e88bb523ff5ee86b5f6e03f458838a565 100644 (file)
@@ -2718,7 +2718,7 @@ packages:
       '@istanbuljs/schema': 0.1.3
       find-up: 5.0.0
       foreground-child: 2.0.0
-      istanbul-lib-coverage: 3.2.1
+      istanbul-lib-coverage: 3.2.2
       istanbul-lib-report: 3.0.1
       istanbul-reports: 3.1.6
       rimraf: 3.0.2
@@ -6011,8 +6011,8 @@ packages:
       lodash.uniqby: 4.7.0
     dev: true
 
-  /istanbul-lib-coverage@3.2.1:
-    resolution: {integrity: sha512-opCrKqbthmq3SKZ10mFMQG9dk3fTa3quaOLD35kJa5ejwZHd9xAr+kLuziiZz2cG32s4lMZxNdmdcEQnTDP4+g==}
+  /istanbul-lib-coverage@3.2.2:
+    resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==}
     engines: {node: '>=8'}
     dev: true
 
@@ -6020,7 +6020,7 @@ packages:
     resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==}
     engines: {node: '>=10'}
     dependencies:
-      istanbul-lib-coverage: 3.2.1
+      istanbul-lib-coverage: 3.2.2
       make-dir: 4.0.0
       supports-color: 7.2.0
     dev: true
index 6a3d30fee9bbcebdc264a6239dfaec8601e1c5eb..6d8c2228b546abaffb220263ace48f17d370f9a3 100644 (file)
@@ -37,6 +37,9 @@ export const sleep = async (milliSeconds: number): Promise<NodeJS.Timeout> => {
 
 export const formatDurationMilliSeconds = (duration: number): string => {
   duration = convertToInt(duration);
+  if (duration < 0) {
+    throw new RangeError('Duration cannot be negative');
+  }
   const days = Math.floor(duration / (24 * 3600 * 1000));
   const hours = Math.floor(millisecondsToHours(duration) - days * 24);
   const minutes = Math.floor(
@@ -48,12 +51,15 @@ export const formatDurationMilliSeconds = (duration: number): string => {
       hoursToSeconds(hours) -
       minutesToSeconds(minutes),
   );
-  return formatDuration({
-    days,
-    hours,
-    minutes,
-    seconds,
-  });
+  return formatDuration(
+    {
+      days,
+      hours,
+      minutes,
+      seconds,
+    },
+    { zero: true },
+  );
 };
 
 export const formatDurationSeconds = (duration: number): string => {
index 8c94bd8ff3f9ac1d11a124a855a4f079e610ede2..a4b864a91f211973ca316189d64aed5581a35aec 100644 (file)
@@ -42,7 +42,7 @@
     "@types/node": "^20.9.0",
     "@typescript-eslint/eslint-plugin": "^6.10.0",
     "@typescript-eslint/parser": "^6.10.0",
-    "@vitejs/plugin-vue": "^4.4.0",
+    "@vitejs/plugin-vue": "^4.4.1",
     "@vitejs/plugin-vue-jsx": "^3.0.2",
     "@vitest/coverage-v8": "^0.34.6",
     "@vue/eslint-config-prettier": "^8.0.0",
index ddfac46c1470f3b93570cb1e280726725266dfdc..221e1f05dbb7806530c72d037f004cbc4d5cddae 100644 (file)
@@ -38,8 +38,8 @@ devDependencies:
     specifier: ^6.10.0
     version: 6.10.0(eslint@8.53.0)(typescript@5.2.2)
   '@vitejs/plugin-vue':
-    specifier: ^4.4.0
-    version: 4.4.0(vite@4.5.0)(vue@3.3.8)
+    specifier: ^4.4.1
+    version: 4.4.1(vite@4.5.0)(vue@3.3.8)
   '@vitejs/plugin-vue-jsx':
     specifier: ^3.0.2
     version: 3.0.2(vite@4.5.0)(vue@3.3.8)
@@ -957,8 +957,8 @@ packages:
       - supports-color
     dev: true
 
-  /@vitejs/plugin-vue@4.4.0(vite@4.5.0)(vue@3.3.8):
-    resolution: {integrity: sha512-xdguqb+VUwiRpSg+nsc2HtbAUSGak25DXYvpQQi4RVU1Xq1uworyoH/md9Rfd8zMmPR/pSghr309QNcftUVseg==}
+  /@vitejs/plugin-vue@4.4.1(vite@4.5.0)(vue@3.3.8):
+    resolution: {integrity: sha512-HCQG8VDFDM7YDAdcj5QI5DvUi+r6xvo9LgvYdk7LSkUNwdpempdB5horkMSZsbdey9Ywsf5aaU8kEPw9M5kREA==}
     engines: {node: ^14.18.0 || >=16.0.0}
     peerDependencies:
       vite: ^4.0.0
@@ -975,7 +975,7 @@ packages:
     dependencies:
       '@ampproject/remapping': 2.2.1
       '@bcoe/v8-coverage': 0.2.3
-      istanbul-lib-coverage: 3.2.1
+      istanbul-lib-coverage: 3.2.2
       istanbul-lib-report: 3.0.1
       istanbul-lib-source-maps: 4.0.1
       istanbul-reports: 3.1.6
@@ -2731,8 +2731,8 @@ packages:
     resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
     dev: true
 
-  /istanbul-lib-coverage@3.2.1:
-    resolution: {integrity: sha512-opCrKqbthmq3SKZ10mFMQG9dk3fTa3quaOLD35kJa5ejwZHd9xAr+kLuziiZz2cG32s4lMZxNdmdcEQnTDP4+g==}
+  /istanbul-lib-coverage@3.2.2:
+    resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==}
     engines: {node: '>=8'}
     dev: true
 
@@ -2740,7 +2740,7 @@ packages:
     resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==}
     engines: {node: '>=10'}
     dependencies:
-      istanbul-lib-coverage: 3.2.1
+      istanbul-lib-coverage: 3.2.2
       make-dir: 4.0.0
       supports-color: 7.2.0
     dev: true
@@ -2750,7 +2750,7 @@ packages:
     engines: {node: '>=10'}
     dependencies:
       debug: 4.3.4
-      istanbul-lib-coverage: 3.2.1
+      istanbul-lib-coverage: 3.2.2
       source-map: 0.6.1
     transitivePeerDependencies:
       - supports-color