Merge branch 'delete-sql-spec-ts-2' of github.com:budibase/budibase into delete-sql-spec-ts-2

This commit is contained in:
Sam Rose 2024-05-22 16:58:04 +01:00
commit a9e2e151fc
No known key found for this signature in database
3 changed files with 9 additions and 2 deletions

View File

@ -177,7 +177,7 @@ export const stringifyDate = (
const year = value.year() const year = value.year()
const month = `${value.month() + 1}`.padStart(2, "0") const month = `${value.month() + 1}`.padStart(2, "0")
const day = `${value.date()}`.padStart(2, "0") const day = `${value.date()}`.padStart(2, "0")
return `${year}-${month}-${day}T00:00:00.000` return `${year}-${month}-${day}`
} }
// Otherwise use a normal ISO string with time and timezone // Otherwise use a normal ISO string with time and timezone

View File

@ -105,6 +105,9 @@ export function processDates<T extends Row | Row[]>(
if (schema.type !== FieldType.DATETIME) { if (schema.type !== FieldType.DATETIME) {
continue continue
} }
if (schema.dateOnly) {
continue
}
if (!schema.timeOnly && !schema.ignoreTimezones) { if (!schema.timeOnly && !schema.ignoreTimezones) {
datesWithTZ.push(column) datesWithTZ.push(column)
} }

View File

@ -134,7 +134,11 @@ export function parse(rows: Rows, schema: TableSchema): Rows {
if (columnType === FieldType.NUMBER) { if (columnType === FieldType.NUMBER) {
// If provided must be a valid number // If provided must be a valid number
parsedRow[columnName] = columnData ? Number(columnData) : columnData parsedRow[columnName] = columnData ? Number(columnData) : columnData
} else if (columnType === FieldType.DATETIME && !columnSchema.timeOnly) { } else if (
columnType === FieldType.DATETIME &&
!columnSchema.timeOnly &&
!columnSchema.dateOnly
) {
// If provided must be a valid date // If provided must be a valid date
parsedRow[columnName] = columnData parsedRow[columnName] = columnData
? new Date(columnData).toISOString() ? new Date(columnData).toISOString()