title: sorting date pipe in ascending order using custom date pipe in angular 12
body: <p>Hi I'm trying to sort the dates in ascending order instead of decending. This is the code I that I have currently.</p>
  <p>custome.pipe.ts</p>
  <pre><code>import {pipe, pipetransform} from '@angular/core';
  import * moment from 'moment'
  
  @pipe({
   name: 'customDate'
  })
  
  export class customDatePipe implements pipeTransform{
   transform(value: number | Date, formate?: string): string {
    if(value){
    const local = navigator.language;
    if(!format){
    format = 'L';
  }
  return moment(value, format, local).format(format);
  }
  return '-';
  }
  }
  </code></pre>
  <p>Cards.ts</p>
  <pre><code>@input() title: string;
  @inpur() eventId: string;
  @input() date: Date;
  
  toString(date: Date){
   return new Date(date?.toString()?.slice(0, -1))
  }
  </code></pre>
  <p>card.html</p>
  <pre><code>&lt;div {{toString(date) | customDate}}&gt;&lt;/div&gt;
  </code></pre>
  <p>event-list.html</p>
  <pre><code>    &lt;app-cards
      *ngFor=&quot;let event of projectEventList.projectsEvents&quot;
       (cardClick)=&quot;onClick($event, true);
        [date]=&quot;getDate(event.eventDescription)&quot;&gt;&lt;app-cards&gt;
  </code></pre>
  <p>event-list.ts</p>
  <pre><code>    &lt;privatr getProjectEvents(projectId: number){
    this.projectEventSubscription = this.eventService.getProjectEvents(projectId).subscribe(events: PlukEvent[]) =&gt; {
  event.sort(a:plukEvent, b:PlukEvent) =&gt;(a.eventDate &gt; b.eventDate ? 1 : b.event &gt; a.eventDate ? -1 : 0))
  
  this.projectEvents = events;
  this.projectEventListSerive.setProjectEvent(events)
  }
  
  }
  </code></pre>