Dev Teywa

Dev Teywa

  • NA
  • 250
  • 40.6k

filter ,date pipe using angular2

Feb 6 2018 12:29 PM
hi,
I want to filter some details by start date and end date
PS: i have array in component contains details and start date and end date
i created this pipe but it doesn't work
how to do please
and thanks in advance
 
 
  1. import { Pipe, PipeTransform } from '@angular/core';    
  2. import { DatePipe } from '@angular/common';    
  3.     
  4. @Pipe({    
  5.     name: 'dateFormatPipe',    
  6. })    
  7. export class dateFormatPipe implements PipeTransform {    
  8.     transform(projetList:any,value1: string,value2: string) {    
  9.            
  10.         if (projetList && projetList.length)    
  11.         {    
  12.             var datePipe = new DatePipe("en-US");    
  13.             value1datePipe.transform(value1, 'dd/MM/yyyy');    
  14.             value2datePipe.transform(value2, 'dd/MM/yyyy');    
  15.                 
  16.             projetList.forEach(proj => {      
  17.                 if (value1 >= value2)     
  18.                 {      
  19.                      return proj.title;    
  20.                 }      
  21.             });     
  22.         }    
  23.         else    
  24.         {    
  25.             return projetList;    
  26.         }    
  27.            
  28.             
  29.     }    
  30. }   
 

Answers (11)