1
0
Fork 0
mirror of synced 2024-09-09 22:16:26 +12:00

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 month = `${value.month() + 1}`.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

View file

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

View file

@ -134,7 +134,11 @@ export function parse(rows: Rows, schema: TableSchema): Rows {
if (columnType === FieldType.NUMBER) {
// If provided must be a valid number
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
parsedRow[columnName] = columnData
? new Date(columnData).toISOString()