From a895896155209805706d61d1d3b0a72d8fd0c30e Mon Sep 17 00:00:00 2001 From: Terry Sutton Date: Wed, 14 Sep 2022 10:36:20 -0230 Subject: [PATCH] Fix case where date is null --- .../SidePanelEditor/RowEditor/RowEditor.utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts index 0a866d85283..2d65caf9c96 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts @@ -177,11 +177,13 @@ const nowDateTimeValue = (format: string) => { } const convertPostgresDatetimeToInputDatetime = (format: string, value: string) => { - const valueWithSlashes = value.replaceAll('-', '/') + if (value) { + value = value.includes('-') ? value.replaceAll('-', '/') : value + } if (!value || value.length == 0) return '' if (TIMESTAMP_TYPES.includes(format)) { - return dayjs(valueWithSlashes).format('YYYY-MM-DDTHH:mm:ss') + return dayjs(value).format('YYYY-MM-DDTHH:mm:ss') } else if (TIME_TYPES.includes(format)) { const serverTimeFormat = value && value.includes('+') ? 'HH:mm:ssZZ' : 'HH:mm:ss' return dayjs(value, serverTimeFormat).format('HH:mm:ss')