@dexteel/mesf-core 4.8.1 → 4.8.2

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.
package/dist/index.esm.js CHANGED
@@ -10797,14 +10797,40 @@ var useTagsTableStyles = makeStyles$1(function (theme) { return ({
10797
10797
  }
10798
10798
  }); });
10799
10799
 
10800
- var timeDifference = function (start, end) {
10801
- var differenceMilliseconds = start - end;
10802
- var seconds = Math.floor(differenceMilliseconds / 1000);
10803
- var minutes = Math.floor(seconds / 60);
10804
- var hours = Math.floor(minutes / 60);
10805
- var remainingMinutes = minutes % 60;
10806
- var remainingSeconds = seconds % 60;
10807
- return "".concat(hours, "h ").concat(remainingMinutes, "m ").concat(remainingSeconds, "s");
10800
+ var formatTimeDiffWithMs = function (start, end) {
10801
+ // Calculate total difference in milliseconds
10802
+ var totalMilliseconds = end - start;
10803
+ // Convert milliseconds to seconds, minutes, hours, days, and months for comparison
10804
+ var seconds = totalMilliseconds / 1000;
10805
+ var minutes = seconds / 60;
10806
+ var hours = minutes / 60;
10807
+ var days = hours / 24;
10808
+ var months = days / 30; // Approximation of a month
10809
+ var remainingSeconds = seconds % 60; // Remaining seconds after full minutes
10810
+ if (months > 12) {
10811
+ var years = months / 12;
10812
+ return "".concat(Math.floor(years), " years, ").concat(Math.floor(months % 12), " months");
10813
+ }
10814
+ else if (months > 6) {
10815
+ return "".concat(Math.floor(months), " months, ").concat(Math.floor(days % 30), " days");
10816
+ }
10817
+ else if (days > 10) {
10818
+ return "".concat(Math.floor(days), " days, ").concat(Math.floor(hours % 24), " hours");
10819
+ }
10820
+ else if (days > 1) {
10821
+ return "".concat(Math.floor(days), " days, ").concat(Math.floor(hours % 24), " hours");
10822
+ }
10823
+ else if (hours > 12) {
10824
+ return "".concat(Math.floor(hours), " hours, ").concat(Math.floor(minutes % 60), " minutes, ").concat(remainingSeconds.toFixed(2), " seconds");
10825
+ }
10826
+ else if (hours < 1) {
10827
+ // If there are 0 hours, return just minutes and remaining seconds
10828
+ return "".concat(Math.floor(minutes), " minutes, ").concat(remainingSeconds.toFixed(2), " seconds");
10829
+ }
10830
+ else {
10831
+ // For time intervals less than 12 hours but more than 1 hour, return hours, minutes, and remaining seconds
10832
+ return "".concat(Math.floor(hours), " hours, ").concat(Math.floor(minutes % 60), " minutes, ").concat(remainingSeconds.toFixed(2), " seconds");
10833
+ }
10808
10834
  };
10809
10835
 
10810
10836
  var TableComponent = function (_a) {
@@ -11015,12 +11041,9 @@ var TableComponent = function (_a) {
11015
11041
  React__default.createElement("th", { className: classes.color }),
11016
11042
  React__default.createElement("th", { colSpan: 4, className: "".concat(classes.topTitles, " ").concat(classes.scale) }, "Scale"),
11017
11043
  React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
11018
- var date = new Date(cursorData.x1);
11019
- var formattedDate = date.toLocaleString('en-US', {
11020
- hour12: false,
11021
- month: 'short',
11022
- day: 'numeric'
11023
- });
11044
+ var dateX1 = new Date(cursorData.x1);
11045
+ var dateX2 = new Date(cursorData.x2);
11046
+ var formattedDate = dateX1.toLocaleString('en-US', __assign({ hour12: false, month: 'short', day: 'numeric' }, (dateX1.getFullYear() !== dateX2.getFullYear() && { year: 'numeric' })));
11024
11047
  var dateText = "".concat(formattedDate);
11025
11048
  return (React__default.createElement(React__default.Fragment, null,
11026
11049
  React__default.createElement("span", { style: {
@@ -11034,12 +11057,9 @@ var TableComponent = function (_a) {
11034
11057
  dateText));
11035
11058
  })() : null),
11036
11059
  React__default.createElement("th", { className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? (function () {
11037
- var date = new Date(cursorData.x2);
11038
- var formattedDate = date.toLocaleString('en-US', {
11039
- hour12: false,
11040
- month: 'short',
11041
- day: 'numeric'
11042
- });
11060
+ var dateX1 = new Date(cursorData.x1);
11061
+ var dateX2 = new Date(cursorData.x2);
11062
+ var formattedDate = dateX2.toLocaleString('en-US', __assign({ hour12: false, month: 'short', day: 'numeric' }, (dateX1.getFullYear() !== dateX2.getFullYear() && { year: 'numeric' })));
11043
11063
  var dateText = "".concat(formattedDate);
11044
11064
  return (React__default.createElement(React__default.Fragment, null,
11045
11065
  React__default.createElement("span", { style: {
@@ -11052,7 +11072,7 @@ var TableComponent = function (_a) {
11052
11072
  } }),
11053
11073
  dateText));
11054
11074
  })() : null),
11055
- React__default.createElement("th", { colSpan: 3, className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? timeDifference(cursorData.x2, cursorData.x1) : null)))),
11075
+ React__default.createElement("th", { colSpan: 3, className: "".concat(classes.topTitles, " ").concat(classes.xStats) }, cursorData ? formatTimeDiffWithMs(cursorData.x1, cursorData.x2) : null)))),
11056
11076
  React__default.createElement("table", { style: { width: '100%', tableLayout: 'fixed', textAlign: "center" } },
11057
11077
  React__default.createElement("thead", null,
11058
11078
  React__default.createElement("tr", { className: classes.bottomTitlesRow },
@@ -11073,7 +11093,7 @@ var TableComponent = function (_a) {
11073
11093
  minute: '2-digit',
11074
11094
  second: '2-digit'
11075
11095
  });
11076
- var milliseconds = date.getMilliseconds().toString().padStart(2, '0');
11096
+ var milliseconds = (date.getMilliseconds() / 1000).toFixed(2).substring(2);
11077
11097
  var dateText = "".concat(formattedHour, ".").concat(milliseconds, " hs");
11078
11098
  return (React__default.createElement(React__default.Fragment, null, dateText));
11079
11099
  })() : null,
@@ -11088,7 +11108,7 @@ var TableComponent = function (_a) {
11088
11108
  minute: '2-digit',
11089
11109
  second: '2-digit'
11090
11110
  });
11091
- var milliseconds = date.getMilliseconds().toString().padStart(2, '0');
11111
+ var milliseconds = (date.getMilliseconds() / 1000).toFixed(2).substring(2);
11092
11112
  var dateText = "".concat(formattedHour, ".").concat(milliseconds, " hs");
11093
11113
  return (React__default.createElement(React__default.Fragment, null, dateText));
11094
11114
  })() : null,