From d3d7ab38c029fc5ec23767c6c86c49a96e4e329c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EF=B8=8FYaskur=20Dyas=E2=9A=94=E2=9A=94=EF=B8=8F=E2=9A=94?= Date: Thu, 23 Jan 2025 06:32:22 +0700 Subject: [PATCH] fix: fail to fill cell to datetime column(Postgre) fixes #924 --- src/renderer/components/WorkspaceTabQueryTable.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/WorkspaceTabQueryTable.vue b/src/renderer/components/WorkspaceTabQueryTable.vue index b338403f..4a853901 100644 --- a/src/renderer/components/WorkspaceTabQueryTable.vue +++ b/src/renderer/components/WorkspaceTabQueryTable.vue @@ -696,14 +696,14 @@ const fillCell = (event: { name: string; group: string; type: string }) => { } fakeValue = (fakerCustom as any)[event.group][event.name](); + const isDateType = [...DATE, ...DATETIME].includes(selectedCell.value.type); if (['string', 'number'].includes(typeof fakeValue)) { if (typeof fakeValue === 'number') fakeValue = String(fakeValue); - - if (selectedCell.value.length) + if (selectedCell.value.length && !isDateType) fakeValue = fakeValue.substring(0, selectedCell.value.length < 1024 ? Number(selectedCell.value.length) : 1024); } - else if ([...DATE, ...DATETIME].includes(selectedCell.value.type)) + else if (isDateType) fakeValue = moment(fakeValue).format(`YYYY-MM-DD HH:mm:ss${datePrecision}`); else if (TIME.includes(selectedCell.value.type)) fakeValue = moment(fakeValue).format(`HH:mm:ss${datePrecision}`);