title: Angular 5 sort by date
body: <p>I have a table of lessons and I would like to order them by date. Since Angular 5 doesn't have the orderBy pipe and all the solutions I have found so far can only be applied to numbers and strings I would be grateful if someone could help me with this. This is the body of my table </p>
  
  <pre><code>&lt;tbody&gt;
    &lt;tr *ngFor="let lesson of lessons"&gt;
      &lt;th scope="row"&gt;{{lesson.date | date:'dd.MM.yyyy H:mm'}}&lt;/th&gt;
      &lt;td&gt;{{lesson.address.locationName}}&lt;/td&gt;
      &lt;td&gt;{{lesson.topic}}&lt;/td&gt;
      &lt;td&gt;{{lesson.homework}}&lt;/td&gt;     
    &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>and this is a fragment of my component.ts file</p>
  
  <pre><code>public lessons = [];
  
  ngOnInit() {
  this.localStorage.getItem&lt;number&gt;('selectedProfileId').subscribe((id) =&gt; {
       this._profileService.showLessons(id)
       .subscribe(data =&gt; this.lessons = data,
       );
     });     
   } 
  </code></pre>