Skip to content

Commit 2bd6573

Browse files
committed
fix(grid): use date iso value in esf #8562
1 parent a2df096 commit 2bd6573

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

projects/igniteui-angular/src/lib/grids/filtering/excel-style/grid.excel-style-filtering.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
451451
}
452452

453453
for (let index = 0; index < this.uniqueValues.length; index++) {
454-
const value = this.column.dataType === DataType.Date ? this.uniqueValues[index].label : this.uniqueValues[index];
454+
const element = this.uniqueValues[index];
455+
const value = this.column.dataType === DataType.Date && element.value ? new Date(element.value).toISOString() : element.value;
455456
if (this.filterValues.has(value)) {
456457
return true;
457458
}
@@ -531,9 +532,10 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
531532
if (isDateColumn) {
532533
this.filterValues = new Set<any>(this.expressionsList.reduce((arr, e) => {
533534
if (e.expression.condition.name === 'in') {
534-
return [ ...arr, ...Array.from((e.expression.searchVal as Set<any>).values()).map(v => this.getFilterItemLabel(v))];
535+
return [ ...arr, ...Array.from((e.expression.searchVal as Set<any>).values()).map(v =>
536+
new Date(v).toISOString()) ];
535537
}
536-
return [ ...arr, ...[e.expression.searchVal ? this.getFilterItemLabel(e.expression.searchVal) : e.expression.searchVal] ];
538+
return [ ...arr, ...[e.expression.searchVal ? e.expression.searchVal.toISOString() : e.expression.searchVal] ];
537539
}, []));
538540
} else {
539541
this.filterValues = new Set<any>(this.expressionsList.reduce((arr, e) => {
@@ -642,7 +644,9 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
642644
filterListItem.isFiltered = false;
643645

644646
if (shouldUpdateSelection) {
645-
if (this.filterValues.has(element.label || element)) {
647+
const value = this.column.dataType === DataType.Date && element.value ?
648+
new Date(element.value).toISOString() : element.value;
649+
if (this.filterValues.has(value)) {
646650
filterListItem.isSelected = true;
647651
filterListItem.isFiltered = true;
648652
}

0 commit comments

Comments
 (0)