I want to display the list grouping by date in angular 8. Example like this image below but I don't have any idea how to make it working. I am fetching the data from firestore in angular 8.
scan-history.ts
async lastScan(){
let fid = 432820344;
let pid = 580676108;
var unixtimestamp = new Date(new Date().setDate(new Date().getDate() - 2)).valueOf();
await this.api.getB2ChStockMoves(fid.toString()).then(async data => {
console.log(data);
this.lastScanData = data;
}).catch(error => {
console.log(error);
});
}
api.service.ts
public getB2ChStockMoves(freezerid): Promise<any> {
return new Promise<any>((resolve, reject) => {
this.adb.collection('stockmoves_channel',ref=>ref.where('freezerid','==',freezerid).orderBy('unixtimestamp','desc')).get().subscribe((stocks) => {
var data = stocks.docs.map(element => {
item.product.get().then(function (doc) {
item.product = doc.data();
});
item.id = element.id;
return item;
});
resolve(data);
}, error => {
reject(error);
})
});
}
API response data
I am storing the field createdAt so that I can group date based on date. But I am unable to proceed further.

