My service called "getList" returns a list of items. I want to loop through the list of items and format the date. Then return the formatted array.
My current attempt doesnt return the items in the array because I use flatMap in order to loop the items in map.
I'm using angular6 and rxjs.
My attempt:
this.list$ = this.service.getList()
      .pipe(
        flatMap(response => response.items),
        map(item => {
          item.date = moment(item.date).format('YYYY-MM-DD').toString();
          return item;
        })
      );