Browse Source

Merge pull request #7189 from nocodb/nc-fix-date-time-filter

fix: exact date filter not working on datetime
pull/7150/head
Raju Udava 12 months ago committed by GitHub
parent
commit
a4f5fbf1e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/nocodb/src/db/conditionV2.ts

8
packages/nocodb/src/db/conditionV2.ts

@ -580,9 +580,17 @@ const parseConditionV2 = async (
// mysql is case-insensitive for strings, turn to case-sensitive
qb = qb.where(knex.raw('BINARY ?? = ?', [field, val]));
}
} else {
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
qb = qb.orWhereNull(field);

Loading…
Cancel
Save