@@ -498,7 +498,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
498
498
499
499
for ( const expression of this . uniqueValues ) {
500
500
const value = this . getExpressionValue ( expression ) ;
501
- if ( this . filterValues . has ( this . column . dataType === DataType . DateTime ? ( value as any ) . toISOString ( ) : value ) ) {
501
+ if ( this . filterValues . has ( value ) ) {
502
502
return true ;
503
503
}
504
504
}
@@ -571,13 +571,16 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
571
571
private generateUniqueValues ( columnValues : any [ ] ) {
572
572
if ( this . column . dataType === DataType . String && this . column . filteringIgnoreCase ) {
573
573
const filteredUniqueValues = columnValues . map ( s => s ?. toString ( ) . toLowerCase ( ) )
574
- . reduce ( ( map , val , i ) => map . get ( val ) ? map : map . set ( val , columnValues [ i ] ) ,
575
- new Map ( ) ) ;
574
+ . reduce ( ( map , val , i ) => map . get ( val ) ? map : map . set ( val , columnValues [ i ] ) , new Map ( ) ) ;
576
575
this . uniqueValues = Array . from ( filteredUniqueValues . values ( ) ) ;
577
576
} else if ( this . column . dataType === DataType . DateTime ) {
578
577
this . uniqueValues = Array . from ( new Set ( columnValues . map ( v => v . toLocaleString ( ) ) ) ) ;
579
578
this . uniqueValues . forEach ( ( d , i ) => this . uniqueValues [ i ] = new Date ( d ) ) ;
580
- } else {
579
+ } else if ( this . column . dataType === DataType . Time ) {
580
+ this . uniqueValues = Array . from ( new Set ( columnValues . map ( v =>
581
+ new Date ( ) . setHours ( v . getHours ( ) , v . getMinutes ( ) , v . getSeconds ( ) ) ) ) ) ;
582
+ this . uniqueValues . forEach ( ( d , i ) => this . uniqueValues [ i ] = new Date ( d ) ) ;
583
+ } else {
581
584
this . uniqueValues = this . column . dataType === DataType . Date ?
582
585
uniqueDates ( columnValues ) : Array . from ( new Set ( columnValues ) ) ;
583
586
}
@@ -592,6 +595,14 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
592
595
}
593
596
return [ ...arr , ...[ e . expression . searchVal ? e . expression . searchVal . toISOString ( ) : e . expression . searchVal ] ] ;
594
597
} , [ ] ) ) ;
598
+ } else if ( this . column . dataType === DataType . Time ) {
599
+ this . filterValues = new Set < any > ( this . expressionsList . reduce ( ( arr , e ) => {
600
+ if ( e . expression . condition . name === 'in' ) {
601
+ return [ ...arr , ...Array . from ( ( e . expression . searchVal as Set < any > ) . values ( ) ) . map ( v =>
602
+ typeof v === 'string' ? v : new Date ( v ) . toLocaleTimeString ( ) ) ] ;
603
+ }
604
+ return [ ...arr , ...[ e . expression . searchVal ? e . expression . searchVal . toLocaleTimeString ( ) : e . expression . searchVal ] ] ;
605
+ } , [ ] ) ) ;
595
606
} else {
596
607
this . filterValues = new Set < any > ( this . expressionsList . reduce ( ( arr , e ) => {
597
608
if ( e . expression . condition . name === 'in' ) {
@@ -702,7 +713,7 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
702
713
703
714
if ( shouldUpdateSelection ) {
704
715
const value = this . getExpressionValue ( element ) ;
705
- if ( this . filterValues . has ( this . column . dataType === DataType . DateTime ? ( value as any ) . toISOString ( ) : value ) ) {
716
+ if ( this . filterValues . has ( value ) ) {
706
717
filterListItem . isSelected = true ;
707
718
filterListItem . isFiltered = true ;
708
719
}
@@ -816,6 +827,10 @@ export class IgxGridExcelStyleFilteringComponent implements OnDestroy {
816
827
let value ;
817
828
if ( this . column . dataType === DataType . Date ) {
818
829
value = element && element . value ? new Date ( element . value ) . toISOString ( ) : element . value ;
830
+ } else if ( this . column . dataType === DataType . DateTime ) {
831
+ value = element ? new Date ( element ) . toISOString ( ) : element ;
832
+ } else if ( this . column . dataType === DataType . Time ) {
833
+ value = element ? new Date ( element ) . toLocaleTimeString ( ) : element ;
819
834
} else {
820
835
value = element ;
821
836
}
0 commit comments