1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

Merge pull request #925 from dyaskur/develop

fix: fail to fill cell to datetime column(Postgre) fixes #924
This commit is contained in:
2025-01-23 09:17:40 +01:00
committed by GitHub

View File

@@ -696,15 +696,15 @@ const fillCell = (event: { name: string; group: string; type: string }) => {
} }
fakeValue = (fakerCustom as any)[event.group][event.name](); fakeValue = (fakerCustom as any)[event.group][event.name]();
if (['string', 'number'].includes(typeof fakeValue)) { const isDateType = [...DATE, ...DATETIME].includes(selectedCell.value.type);
if (isDateType)
fakeValue = moment(fakeValue).format(`YYYY-MM-DD HH:mm:ss${datePrecision}`);
else if (['string', 'number'].includes(typeof fakeValue)) {
if (typeof fakeValue === 'number') if (typeof fakeValue === 'number')
fakeValue = String(fakeValue); fakeValue = String(fakeValue);
if (selectedCell.value.length) if (selectedCell.value.length)
fakeValue = fakeValue.substring(0, selectedCell.value.length < 1024 ? Number(selectedCell.value.length) : 1024); fakeValue = fakeValue.substring(0, selectedCell.value.length < 1024 ? Number(selectedCell.value.length) : 1024);
} }
else if ([...DATE, ...DATETIME].includes(selectedCell.value.type))
fakeValue = moment(fakeValue).format(`YYYY-MM-DD HH:mm:ss${datePrecision}`);
else if (TIME.includes(selectedCell.value.type)) else if (TIME.includes(selectedCell.value.type))
fakeValue = moment(fakeValue).format(`HH:mm:ss${datePrecision}`); fakeValue = moment(fakeValue).format(`HH:mm:ss${datePrecision}`);