Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[fix] Empty cells with date time data are filled with Invalid date (#2201)
Igor Dykhta95fd23699730
diff --git a/src/components/src/common/data-table/index.tsx b/src/components/src/common/data-table/index.tsxindex e7e244ac1..6204b7580 100644--- a/src/components/src/common/data-table/index.tsx+++ b/src/components/src/common/data-table/index.tsx@@ -219,8 +219,11 @@ const getRowCell = (const {type} = colMeta[column];let value = dataContainer.valueAt(rowIdx, columns.indexOf(column));- if (value === undefined) value = 'Err';- return formatter ? formatter(value) : parseFieldValue(value, type);+ return value === null || value === undefined || value === ''+ ? ''+ : formatter+ ? formatter(value)+ : parseFieldValue(value, type);};type StatsControlProps = {diff --git a/src/utils/src/data-utils.ts b/src/utils/src/data-utils.tsindex e90bbb71a..786385805 100644--- a/src/utils/src/data-utils.ts+++ b/src/utils/src/data-utils.ts@@ -454,5 +454,6 @@ export function datetimeFormatter(.utc(ts).tz(timezone).format(format)- : format => ts => moment.utc(ts).format(format);+ : // return empty string instead of 'Invalid date' if ts is undefined/null+ format => ts => (ts ? moment.utc(ts).format(format) : '');}diff --git a/test/node/utils/data-utils-test.js b/test/node/utils/data-utils-test.jsindex ffaca5d39..10dddbe67 100644--- a/test/node/utils/data-utils-test.js+++ b/test/node/utils/data-utils-test.js@@ -192,6 +192,30 @@ test('dataUtils -> getFormatter', t => {{input: ['yn'],assert: [true, 'yes']+ },+ {+ input: ['L LT'],+ assert: ['2011-04-10 00:00', '04/10/2011 12:00 AM']+ },+ {+ input: ['L LT'],+ assert: [null, '']+ },+ {+ input: ['L LT'],+ assert: [undefined, '']+ },+ {+ input: ['L LT'],+ assert: ['', '']+ },+ {+ input: ['L'],+ assert: ['2011-04-10', '04/10/2011']+ },+ {+ input: ['L'],+ assert: [null, '']}];