Open Bonapara opened 1 month ago
Rename Existing Filters
isMatchingDateFilter.ts
to rename Greater than
to Is After
and Less than
to Is Before
.
// isMatchingDateFilter.ts
const filterMap = {
'Is After': (date, value) => date > value,
'Is Before': (date, value) => date < value,
// other filters
};
Add New Filters
isMatchingDateFilter.ts
to include new filters: Is
, Is Empty
, Is Not Empty
, Is Relative to today
.
// isMatchingDateFilter.ts
const filterMap = {
'Is': (date, value) => date === value,
'Is Empty': (date) => !date,
'Is Not Empty': (date) => !!date,
'Is Relative to today': (date, value) => {
// Implement relative date logic
},
// existing filters
};
Update GraphQL Input Types
date-time-filter.input-type.ts
to include new filter types.
// date-time-filter.input-type.ts
export const DateTimeFilterInputType = new GraphQLInputObjectType({
name: 'DateTimeFilterInput',
fields: {
is: { type: GraphQLString },
isEmpty: { type: GraphQLBoolean },
isNotEmpty: { type: GraphQLBoolean },
isRelativeToToday: { type: GraphQLString },
// existing fields
}
});
Update Filter Operand Types
ViewFilterOperand.ts
.
// ViewFilterOperand.ts
export enum ViewFilterOperand {
Is = 'Is',
IsEmpty = 'IsEmpty',
IsNotEmpty = 'IsNotEmpty',
IsRelativeToToday = 'IsRelativeToToday',
// existing operands
}
Update Tests
isMatchingDateFilter.spec.ts
for new filters.
// isMatchingDateFilter.spec.ts
describe('isMatchingDateFilter', () => {
it('should match Is filter', () => {
// test implementation
});
it('should match Is Empty filter', () => {
// test implementation
});
it('should match Is Not Empty filter', () => {
// test implementation
});
it('should match Is Relative to today filter', () => {
// test implementation
});
// existing tests
});
Related to https://github.com/twentyhq/twenty/issues/6299 that should be handled first
Current behavior
Users can only filter dates with the
Greater than
andLess than
filters.Desired behavior
We want to rename
Greater than
toIs After
We want to renameLess than
toIs Before
We want to introduce some new filters:
Is Relative
We should reflect the selected values in the calendar. For instance, if someone chooses "This Week," it should be displayed in the calendar as selected.
Figma
https://www.figma.com/design/xt8O9mFeLl46C5InWwoMrN/Twenty?node-id=2709-52753&t=jqRWyAJosBHzOW0I-11