Display json records by date


#1

Hello everyone,

I would like to sort workouts by the day. For example:

09.10

  • running

  • basketball

07.10

  • push-ups
  • football

My json log for one record looks like this:
> “title”: “Cycling to NY”,
> “type”: “Cycling”,
> “distance”: “22”,
> “duration”: [
> {
> “hours”: “1”
> },
> {
> “minutes”: “20”
> },
> {
> “seconds”: “2”
> }
> ],
> “note”: “Nice trip”,
> “date”: “2016-10-13T08:28:57.568Z”

I know how to display workouts and their titles but how to sort them and display by date. Currently my workouts.html looks like this:

    <ion-header>
      <ion-navbar>
        <ion-title>Workouts</ion-title>
      </ion-navbar>
    </ion-header>

    <ion-content padding class="workouts">
      <h2>Workouts</h2>
      <ion-list>
      	
      	<ion-item *ngFor="let workout of workouts" (click)="workoutSelected($event,workout)">
      		{{workout.title}}
        </ion-item>
      </ion-list>

  
</ion-content>

Have you got any ideas how can i achieve that?