From 0c3aa43782af0cda33b344c842547c7f0f2d2ffc Mon Sep 17 00:00:00 2001 From: Harshith Venkatesh Date: Thu, 21 Nov 2024 11:35:32 +0530 Subject: [PATCH 1/2] fix: enable date filter to contain maxYear for filters in custom object --- .../filter/filter-condition/filter-condition.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/crayons-extended/custom-objects/src/components/filter/filter-condition/filter-condition.tsx b/packages/crayons-extended/custom-objects/src/components/filter/filter-condition/filter-condition.tsx index 6a418546a..00106ba5b 100644 --- a/packages/crayons-extended/custom-objects/src/components/filter/filter-condition/filter-condition.tsx +++ b/packages/crayons-extended/custom-objects/src/components/filter/filter-condition/filter-condition.tsx @@ -186,7 +186,13 @@ export class FilterCondition { > ); case 'DATE_RANGE': - props = { displayFormat: 'dd MMM yyyy', readonly: true, mode: 'range' }; + props = { + displayFormat: 'dd MMM yyyy', + readonly: true, + mode: 'range', + maxYear: 2080, + minYear: 1970, + }; if (this.value) { const { from: fromDate, to: toDate } = this.value; if (fromDate && toDate) { From 0734b71f461adb2767248de08b908bd6b8519346 Mon Sep 17 00:00:00 2001 From: Harshith Venkatesh Date: Thu, 21 Nov 2024 12:24:03 +0530 Subject: [PATCH 2/2] fix: set condition for maxYear and minYear for DATE props --- .../filter/filter-condition/filter-condition.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/crayons-extended/custom-objects/src/components/filter/filter-condition/filter-condition.tsx b/packages/crayons-extended/custom-objects/src/components/filter/filter-condition/filter-condition.tsx index 00106ba5b..17794f90f 100644 --- a/packages/crayons-extended/custom-objects/src/components/filter/filter-condition/filter-condition.tsx +++ b/packages/crayons-extended/custom-objects/src/components/filter/filter-condition/filter-condition.tsx @@ -122,6 +122,12 @@ export class FilterCondition { renderContent(condition) { let props = {}; + const dateProps = { + displayFormat: 'dd MMM yyyy', + readonly: true, + maxYear: 2080, + minYear: 1970, + }; switch (condition.type) { case 'TEXT': case 'NUMBER': @@ -172,8 +178,7 @@ export class FilterCondition { ); case 'DATE': props = { - displayFormat: 'dd MMM yyyy', - readonly: true, + ...dateProps, value: this.value, }; return ( @@ -187,11 +192,8 @@ export class FilterCondition { ); case 'DATE_RANGE': props = { - displayFormat: 'dd MMM yyyy', - readonly: true, + ...dateProps, mode: 'range', - maxYear: 2080, - minYear: 1970, }; if (this.value) { const { from: fromDate, to: toDate } = this.value;