Browse Source

feat(nocodb): prevent empty value for date & datetime values for filtering

pull/5106/head
Wing-Kam Wong 2 years ago
parent
commit
9f16ae7760
  1. 9
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

9
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts

@ -271,6 +271,15 @@ const parseConditionV2 = async (
return (qb: Knex.QueryBuilder) => {
let [field, val] = [_field, _val];
if (
[UITypes.Date, UITypes.DateTime].includes(column.uidt) &&
!val &&
['is', 'isnot'].includes(filter.comparison_op)
) {
// for date & datetime,
// val cannot be empty for non-is & non-isnot filters
return;
}
switch (filter.comparison_op) {
case 'eq':
if (qb?.client?.config?.client === 'mysql2') {

Loading…
Cancel
Save