diff --git a/src/components/CellViews/DateTimeCell.js b/src/components/CellViews/DateTimeCell.js
index 9aecaff3..7c5d1ff3 100644
--- a/src/components/CellViews/DateTimeCell.js
+++ b/src/components/CellViews/DateTimeCell.js
@@ -1,12 +1,12 @@
import { format, isValid } from "date-fns";
+export const dateTimeFormat = "MMM dd yyyy, HH:mm:ss";
export const DateTimeCell = (column) => {
const date = new Date(column.value);
- const dateFormat = "MMM dd yyyy, HH:mm:ss";
return column.value ? (
- {isValid(date) ? format(date, dateFormat) : ""}
+ {isValid(date) ? format(date, dateTimeFormat) : ""}
) : (
""
diff --git a/src/components/CellViews/StringCell.js b/src/components/CellViews/StringCell.js
index 57bf479e..d4c7a3bc 100644
--- a/src/components/CellViews/StringCell.js
+++ b/src/components/CellViews/StringCell.js
@@ -1,24 +1,31 @@
-const valueToString = (value) => {
+import { format, isValid } from "date-fns";
+import { dateTimeFormat } from "./DateTimeCell";
+
+export const valueToString = (value) => {
if (typeof value === "string") return value;
+ /* if undefined or null we'll treat it as empty string */
+ if (value === undefined || value === null) return "";
+ if (value instanceof Date && isValid(value)) return format(value, dateTimeFormat);
try {
+ /* JSON.stringify will handle JSON and non-strings, non-null, non-undefined */
return JSON.stringify(value);
} catch {
- return value.toString();
+ return 'Error: Invalid JSON';
}
};
export const StringCell = ({ value }) => {
+ const style = {
+ maxHeight: "100%",
+ overflow: "hidden",
+ fontSize: 12,
+ lineHeight: "16px",
+ };
+
return (
-
- {value ? valueToString(value) : ""}
+
+ {valueToString(value)}
);
};