From 030269f684a46757466fb54bf96fa5422abd4e1d Mon Sep 17 00:00:00 2001 From: Vicky Bansal <67091118+vicky-primathon@users.noreply.github.com> Date: Mon, 15 Mar 2021 10:59:01 +0530 Subject: [PATCH] Display the date column output correctly in table when using JS toggle for `Display date format` --- app/client/src/widgets/TableWidget/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/client/src/widgets/TableWidget/index.tsx b/app/client/src/widgets/TableWidget/index.tsx index 06acdb5efa..b3e87f7c43 100644 --- a/app/client/src/widgets/TableWidget/index.tsx +++ b/app/client/src/widgets/TableWidget/index.tsx @@ -291,10 +291,14 @@ class TableWidget extends BaseWidget { switch (type) { case ColumnTypes.DATE: let isValidDate = true; - let outputFormat = column.metaProperties.format; + let outputFormat = Array.isArray(column.metaProperties.format) + ? column.metaProperties.format[row] + : column.metaProperties.format; let inputFormat; try { - const type = column.metaProperties.inputFormat; + const type = Array.isArray(column.metaProperties.inputFormat) + ? column.metaProperties.inputFormat[row] + : column.metaProperties.inputFormat; if (type !== "Epoch" && type !== "Milliseconds") { inputFormat = type; moment(value, inputFormat);