From 5046d4bb737f3bf74d25023191587f6a919fe0e8 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Fri, 8 Dec 2023 12:14:33 +0000 Subject: [PATCH] fix(nocodb): cast date on eq filter in datetime --- packages/nocodb/src/db/conditionV2.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/db/conditionV2.ts b/packages/nocodb/src/db/conditionV2.ts index c50ca1dba1..5a990ab1b6 100644 --- a/packages/nocodb/src/db/conditionV2.ts +++ b/packages/nocodb/src/db/conditionV2.ts @@ -581,7 +581,15 @@ const parseConditionV2 = async ( qb = qb.where(knex.raw('BINARY ?? = ?', [field, val])); } } else { - qb = qb.where(field, val); + if(column.uidt === UITypes.DateTime) { + if(qb.client.config.client === 'pg') { + qb = qb.where(knex.raw('??::date = ?', [field, val])); + } else { + qb = qb.where(knex.raw('DATE(??) = DATE(?)', [field, val])); + } + } else { + qb = qb.where(field, val); + } } if (column.uidt === UITypes.Rating && val === 0) { // unset rating is considered as NULL