We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44b12da commit e714651Copy full SHA for e714651
src/useTimeLabels.js
@@ -19,13 +19,18 @@ export function useTimeLabels({
19
}) {
20
const out = [];
21
if (!xl.enable || values.length === 0) {
22
- for (let i = sliceStart; i < sliceEnd; i++) {
+ for (let i = sliceStart; i < sliceEnd; i += 1) {
23
out.push({ text: String(values[i] ?? i), absoluteIndex: i });
24
}
25
return out;
26
27
28
- const window = values.slice(sliceStart, sliceEnd);
+ const formattedValues = values.map(v => {
29
+ const f = new Date(v).getTime();
30
+ return isNaN(f) ? v : f
31
+ });
32
+
33
+ const window = formattedValues.slice(sliceStart, sliceEnd);
34
if (window.length === 0) return [];
35
const minX = window[0], maxX = window[window.length - 1];
36
const dt = useDateTime({
0 commit comments