Skip to content

Commit

Permalink
Merge pull request #954 from harshith-venkatesh-freshworks/fix-filter…
Browse files Browse the repository at this point in the history
…-with-set-maxYear

fix: enable date filter to contain maxYear for filters in custom object
  • Loading branch information
rihansiddhi authored Nov 25, 2024
2 parents 6e42dbc + 0734b71 commit 256b21e
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -172,8 +178,7 @@ export class FilterCondition {
);
case 'DATE':
props = {
displayFormat: 'dd MMM yyyy',
readonly: true,
...dateProps,
value: this.value,
};
return (
Expand All @@ -186,7 +191,10 @@ export class FilterCondition {
></fw-date-condition>
);
case 'DATE_RANGE':
props = { displayFormat: 'dd MMM yyyy', readonly: true, mode: 'range' };
props = {
...dateProps,
mode: 'range',
};
if (this.value) {
const { from: fromDate, to: toDate } = this.value;
if (fromDate && toDate) {
Expand Down

0 comments on commit 256b21e

Please sign in to comment.