Return date only as dates

This commit is contained in:
Adria Navarro 2024-05-22 11:58:57 +02:00
parent 5d29cfceb7
commit eac426f3c0
2 changed files with 8 additions and 1 deletions

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()