versacall-dashboards-library-react 2.0.26 → 2.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -127,6 +127,8 @@ function calculateDashboardVariables(variables, dashboardVariables) {
127
127
  theNumber = Number(variablesProcessed[i].defaultValue);
128
128
  }
129
129
 
130
+ variablesProcessed[i].calculated = "".concat(theNumber);
131
+
130
132
  if (variablesProcessed[i].format.type === 'timespan') {
131
133
  variablesProcessed[i].value = (0, _convertSecondsToElapsedTime.default)(theNumber, 'H:M:S');
132
134
  } else {
@@ -7,16 +7,30 @@ exports.default = convertSecondsToElapsedTime;
7
7
 
8
8
  function convertSecondsToElapsedTime(inputSeconds, format) {
9
9
  var fromSeconds = Math.floor(inputSeconds);
10
- var days = Math.floor(fromSeconds / 86400);
11
- var hours = Math.floor((fromSeconds - days * 86400) / 3600);
12
- var minutes = Math.floor((fromSeconds - days * 86400 - hours * 3600) / 60);
10
+ var isNegative = fromSeconds < 0;
11
+ var absSeconds = Math.abs(fromSeconds);
12
+ var days = Math.floor(absSeconds / 86400);
13
+ var hours = Math.floor((absSeconds - days * 86400) / 3600);
14
+ var minutes = Math.floor((absSeconds - days * 86400 - hours * 3600) / 60);
15
+ var seconds = absSeconds - days * 86400 - hours * 3600 - minutes * 60;
13
16
  var str = '';
14
- str += hours > 0 ? " ".concat(hours, "h") : '';
15
- str += minutes > 0 ? " ".concat(minutes, "m") : '';
16
17
 
17
- if (format === 'H:M:S') {
18
- var seconds = fromSeconds - days * 86400 - hours * 3600 - minutes * 60;
19
- str += seconds >= 0 ? " ".concat(seconds, "s") : '';
18
+ if (days > 0) {
19
+ str += "".concat(days, "d ").concat(hours, "h ").concat(minutes, "m ").concat(seconds, "s");
20
+ } else if (hours > 0) {
21
+ str = "".concat(hours, "h ").concat(minutes, "m ").concat(seconds, "s");
22
+ } else if (minutes > 0) {
23
+ str = "".concat(minutes, "m ").concat(seconds, "s");
24
+ } else {
25
+ str = "".concat(seconds, "s");
26
+ }
27
+ /* if (format === 'H:M:S') {
28
+ str += seconds >= 0 ? ` ${seconds}s` : '';
29
+ } */
30
+
31
+
32
+ if (isNegative) {
33
+ return "-".concat(str);
20
34
  }
21
35
 
22
36
  return str;
package/package.json CHANGED
@@ -2,10 +2,10 @@
2
2
  "versacall": {
3
3
  "title": "Versacall Dashboards Library React",
4
4
  "applicationType": "react-library",
5
- "build": 26
5
+ "build": 28
6
6
  },
7
7
  "name": "versacall-dashboards-library-react",
8
- "version": "2.0.26",
8
+ "version": "2.0.28",
9
9
  "description": "Versacall Dashboards Library",
10
10
  "main": "dist/index.js",
11
11
  "module": "dist/index.js",