@geotab/zenith 3.13.0-beta.0 → 3.13.0-beta.1

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/README.md CHANGED
@@ -61,6 +61,10 @@ Markdown reference for each component (used by AI tooling and IRIS) lives in [`d
61
61
  - Fix nested `Menu` submenu opening on the wrong side in RTL
62
62
  - Fix column drag handle appearing on the wrong side of the header in RTL
63
63
 
64
+ ### 3.12.3
65
+
66
+ - Fix `LineChart` crash when timed chart has no data
67
+
64
68
  ### 3.12.1
65
69
 
66
70
  - Fix CSS custom properties in `Nav` component
@@ -49,6 +49,11 @@ const getFormatFromDateRange = (minDate, maxDate, ticks) => {
49
49
  };
50
50
  const getDefaultOptions = (yAxis, xAxis, isTimedData, ticks, isDark, translate, isRtl = false) => {
51
51
  const time = getFormatFromDateRange(xAxis.minDate, xAxis.maxDate, ticks);
52
+ // Empty data yields inverted sentinel bounds (min > max); pinning those would make chart.js
53
+ // span ~8.6e15 ms and crash. Only pin a valid range, else let it auto-scale.
54
+ const xMin = Date.parse(xAxis.minDate);
55
+ const xMax = Date.parse(xAxis.maxDate);
56
+ const hasValidTimeRange = isTimedData && Number.isFinite(xMin) && Number.isFinite(xMax) && xMin <= xMax;
52
57
  const textColor = isDark ? "#C0CCD8" : "#4E677E";
53
58
  const primaryYPosition = isRtl ? "right" : "left";
54
59
  const secondaryYPosition = isRtl ? "left" : "right";
@@ -70,8 +75,8 @@ const getDefaultOptions = (yAxis, xAxis, isTimedData, ticks, isDark, translate,
70
75
  }
71
76
  }
72
77
  : undefined,
73
- min: isTimedData ? Date.parse(xAxis.minDate) : undefined,
74
- max: isTimedData ? Date.parse(xAxis.maxDate) : undefined,
78
+ min: hasValidTimeRange ? xMin : undefined,
79
+ max: hasValidTimeRange ? xMax : undefined,
75
80
  ticks: isTimedData
76
81
  ? {
77
82
  autoSkip: false,
@@ -46,6 +46,11 @@ const getFormatFromDateRange = (minDate, maxDate, ticks) => {
46
46
  };
47
47
  export const getDefaultOptions = (yAxis, xAxis, isTimedData, ticks, isDark, translate, isRtl = false) => {
48
48
  const time = getFormatFromDateRange(xAxis.minDate, xAxis.maxDate, ticks);
49
+ // Empty data yields inverted sentinel bounds (min > max); pinning those would make chart.js
50
+ // span ~8.6e15 ms and crash. Only pin a valid range, else let it auto-scale.
51
+ const xMin = Date.parse(xAxis.minDate);
52
+ const xMax = Date.parse(xAxis.maxDate);
53
+ const hasValidTimeRange = isTimedData && Number.isFinite(xMin) && Number.isFinite(xMax) && xMin <= xMax;
49
54
  const textColor = isDark ? "#C0CCD8" : "#4E677E";
50
55
  const primaryYPosition = isRtl ? "right" : "left";
51
56
  const secondaryYPosition = isRtl ? "left" : "right";
@@ -67,8 +72,8 @@ export const getDefaultOptions = (yAxis, xAxis, isTimedData, ticks, isDark, tran
67
72
  }
68
73
  }
69
74
  : undefined,
70
- min: isTimedData ? Date.parse(xAxis.minDate) : undefined,
71
- max: isTimedData ? Date.parse(xAxis.maxDate) : undefined,
75
+ min: hasValidTimeRange ? xMin : undefined,
76
+ max: hasValidTimeRange ? xMax : undefined,
72
77
  ticks: isTimedData
73
78
  ? {
74
79
  autoSkip: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geotab/zenith",
3
- "version": "3.13.0-beta.0",
3
+ "version": "3.13.0-beta.1",
4
4
  "description": "Zenith components library on React",
5
5
  "main": "dist/index.js",
6
6
  "types": "esm/index.d.ts",