From eac426f3c024af1c43c0e8c7dc94f9a907027595 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 22 May 2024 11:58:57 +0200 Subject: [PATCH 1/2] Return date only as dates --- packages/server/src/utilities/rowProcessor/utils.ts | 3 +++ packages/server/src/utilities/schema.ts | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/server/src/utilities/rowProcessor/utils.ts b/packages/server/src/utilities/rowProcessor/utils.ts index 8201680f13..0fa6f62807 100644 --- a/packages/server/src/utilities/rowProcessor/utils.ts +++ b/packages/server/src/utilities/rowProcessor/utils.ts @@ -105,6 +105,9 @@ export function processDates( if (schema.type !== FieldType.DATETIME) { continue } + if (schema.dateOnly) { + continue + } if (!schema.timeOnly && !schema.ignoreTimezones) { datesWithTZ.push(column) } diff --git a/packages/server/src/utilities/schema.ts b/packages/server/src/utilities/schema.ts index 5652391d7a..f73701fdfd 100644 --- a/packages/server/src/utilities/schema.ts +++ b/packages/server/src/utilities/schema.ts @@ -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() From 4e67e05ad1d73645e90dd6320e9cc742731e9bee Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 22 May 2024 14:35:19 +0200 Subject: [PATCH 2/2] Save date only as date --- packages/bbui/src/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bbui/src/helpers.js b/packages/bbui/src/helpers.js index 66bc6551d8..1db4a773ba 100644 --- a/packages/bbui/src/helpers.js +++ b/packages/bbui/src/helpers.js @@ -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