Skip to content

Commit

Permalink
fix(plugin-chart-echarts): normalize temporal string groupbys (#24134)
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro authored May 19, 2023
1 parent d0687d0 commit f817c10
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
NumberFormatter,
TimeFormatter,
SupersetTheme,
normalizeTimestamp,
} from '@superset-ui/core';
import { SortSeriesType } from '@superset-ui/chart-controls';
import { format, LegendComponentOption, SeriesOption } from 'echarts';
Expand Down Expand Up @@ -336,7 +337,12 @@ export function formatSeriesName(
return name.toString();
}
if (name instanceof Date || coltype === GenericDataType.TEMPORAL) {
const d = name instanceof Date ? name : new Date(name);
const normalizedName =
typeof name === 'string' ? normalizeTimestamp(name) : name;
const d =
normalizedName instanceof Date
? normalizedName
: new Date(normalizedName);

return timeFormatter ? timeFormatter(d) : d.toISOString();
}
Expand Down
Loading

0 comments on commit f817c10

Please sign in to comment.