From 55af5f50b12fad5aa59d9ba0f4833bb4210be5c5 Mon Sep 17 00:00:00 2001 From: Adam Driscoll Date: Fri, 17 May 2019 20:27:53 -0600 Subject: [PATCH] Fixes #258 --- .../Components/custom-cell.jsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/UniversalDashboard.Materialize/Components/custom-cell.jsx b/src/UniversalDashboard.Materialize/Components/custom-cell.jsx index b12fcf9e..201be7a7 100644 --- a/src/UniversalDashboard.Materialize/Components/custom-cell.jsx +++ b/src/UniversalDashboard.Materialize/Components/custom-cell.jsx @@ -6,12 +6,13 @@ export default class CustomCell extends React.Component { const validComponents = ["link", "icon", "image", "element"] var y = this.props.value; + var moment2 = moment(y); if (y == null) { return ; } if (y.DateTime) { - var moment2 = moment(y.value); + moment2 = moment(y.value); if (moment2.isValid) { return {moment2.format(this.props.dateTimeFormat)}; } @@ -19,8 +20,14 @@ export default class CustomCell extends React.Component { return {y.DateTime}; } } + else if (moment2.isValid) { + + if (moment2.isValid) { + return {moment2.format(this.props.dateTimeFormat)}; + } + } else if (y.startsWith && y.startsWith("/Date(")){ - var moment2 = moment(y.substr(6), 'x)/"'); + moment2 = moment(y.substr(6), 'x)/"'); if (moment2.isValid) { return {moment2.format(this.props.dateTimeFormat)}; }