fix: null dates in table chart (#17974)

This commit is contained in:
Erik Ritter
2022-01-10 10:07:59 -08:00
committed by GitHub
parent 3a9bd12e3d
commit 1e544ce531
3 changed files with 16 additions and 2 deletions

View File

@@ -23,6 +23,7 @@ import {
getNumberFormatter,
} from '@superset-ui/core';
import { DataColumnMeta } from '../types';
import DateWithFormatter from './DateWithFormatter';
const xss = new FilterXSS({
whiteList: {
@@ -62,7 +63,12 @@ function formatValue(
return [false, ''];
}
// render null as `N/A`
if (value === null) {
if (
value === null ||
// null values in temporal columns are wrapped in a Date object, so make sure we
// handle them here too
(value instanceof DateWithFormatter && value.input === null)
) {
return [false, 'N/A'];
}
if (formatter) {