I get the data like so:
getLeads(): Observable<LeadModel[]> {
return this.angularFireDatabase
.list<LeadModel>(`groups/${this.groupId}/leads`)
.valueChanges()
.pipe(map((res) => orderBy(res, ['createdDate'], ['desc'])));
}
.HTML
<ion-col>
<p>
{{ lead.createdDate | date: 'MMM dd' }}
<br />
{{ lead.createdDate | date: 'h:mm a' }}
</p>
</ion-col>
CodePudding user response:
I have changed my model like so:
createdDate?: number;
Then used unix()
createdDate: dayjs().unix(),
After that:
getLeads(): Observable<LeadModel[]> {
return this.angularFireDatabase
.list<LeadModel>(`groups/${this.groupId}/leads`)
.valueChanges()
.pipe(map((res) => orderBy(res, ['createdDate'], ['desc'])));
}
All are working fine now.