diff --git a/webapp/src/cardFilter.test.ts b/webapp/src/cardFilter.test.ts index 9459de630..2bb003798 100644 --- a/webapp/src/cardFilter.test.ts +++ b/webapp/src/cardFilter.test.ts @@ -280,6 +280,10 @@ describe('src/cardFilter', () => { } test('verify isBefore clause', () => { + const filterClauseIsBeforeEmpty = createFilterClause({propertyId: 'datePropertyID', condition: 'isBefore', values: []}) + const resulta = CardFilter.isClauseMet(filterClauseIsBeforeEmpty, [template], dateCard) + expect(resulta).toBeTruthy() + const filterClauseIsBefore = createFilterClause({propertyId: 'datePropertyID', condition: 'isBefore', values: [beforeRange.toString()]}) const result = CardFilter.isClauseMet(filterClauseIsBefore, [template], dateCard) expect(result).toBeFalsy() @@ -294,6 +298,10 @@ describe('src/cardFilter', () => { }) test('verify isAfter clauses', () => { + const filterClauseIsAfterEmpty = createFilterClause({propertyId: 'datePropertyID', condition: 'isBefore', values: []}) + const resulta = CardFilter.isClauseMet(filterClauseIsAfterEmpty, [template], dateCard) + expect(resulta).toBeTruthy() + const filterClauseIsAfter = createFilterClause({propertyId: 'datePropertyID', condition: 'isAfter', values: [afterRange.toString()]}) const result = CardFilter.isClauseMet(filterClauseIsAfter, [template], dateCard) expect(result).toBeFalsy() @@ -308,6 +316,10 @@ describe('src/cardFilter', () => { }) test('verify is clause', () => { + const filterClauseIsEmpty = createFilterClause({propertyId: 'datePropertyID', condition: 'isBefore', values: []}) + const resulta = CardFilter.isClauseMet(filterClauseIsEmpty, [template], dateCard) + expect(resulta).toBeTruthy() + const filterClauseIsBefore = createFilterClause({propertyId: 'datePropertyID', condition: 'is', values: [beforeRange.toString()]}) const result = CardFilter.isClauseMet(filterClauseIsBefore, [template], dateCard) expect(result).toBeFalsy() diff --git a/webapp/src/cardFilter.ts b/webapp/src/cardFilter.ts index 42eb0b9cd..17a0bd4f0 100644 --- a/webapp/src/cardFilter.ts +++ b/webapp/src/cardFilter.ts @@ -175,6 +175,9 @@ class CardFilter { return !(value as string || '').endsWith(filter.values[0]?.toLowerCase()) } case 'isBefore': { + if (filter.values.length === 0) { + return true + } if (dateValue !== undefined) { const numericFilter = parseInt(filter.values[0], 10) if (template && (template.type === 'createdTime' || template.type === 'updatedTime')) { @@ -192,6 +195,9 @@ class CardFilter { return false } case 'isAfter': { + if (filter.values.length === 0) { + return true + } if (dateValue !== undefined) { const numericFilter = parseInt(filter.values[0], 10) if (template && (template.type === 'createdTime' || template.type === 'updatedTime')) {