Skip to content

Commit

Permalink
filter date field by empty/not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
nh758 committed Jan 3, 2025
1 parent e3fac9b commit 3c09722
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions FilterComplexCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ module.exports = class FilterComplexCore extends ABComponent {
result =
value.setHours(0, 0, 0, 0) == compareValue.setHours(0, 0, 0, 0);
break;
case "is_empty":
result = !value;
break;
case "is_not_empty":
result = !!value;
break;
default:
result = this.queryFieldValid(value, rule, compareValue);
break;
Expand Down Expand Up @@ -578,8 +584,8 @@ module.exports = class FilterComplexCore extends ABComponent {
? connectedVal[field.indexField2.columnName]
: null) ??
connectedVal[field.columnName] ??
connectedVal.id
connectedVal;
connectedVal.id;
connectedVal;
}

// Compare value isn't always a string?
Expand Down Expand Up @@ -959,6 +965,8 @@ module.exports = class FilterComplexCore extends ABComponent {
this.labels.component.onOrAfterCurrentCondition,
last_days: this.labels.component.onLastDaysCondition,
next_days: this.labels.component.onNextDaysCondition,
is_empty: this.labels.component.isEmpty,
is_not_empty: this.labels.component.isNotEmpty,
};

let result = [];
Expand All @@ -970,6 +978,8 @@ module.exports = class FilterComplexCore extends ABComponent {
case "greater_current":
case "less_or_equal_current":
case "greater_or_equal_current":
case "is_empty":
case "is_not_empty":
result.push({
id: condKey,
value: dateConditions[condKey],
Expand Down

0 comments on commit 3c09722

Please sign in to comment.