This is WORKING service class for which return single transaction
getEditTransactionById(id: number): Observable<ITransaction> {
return this.httpClient.get<Result<ITransaction>>(baseUrl'/Transaction/GetEditTransactionById'+ `/${id}`)
.pipe(
map((res)=>{
res.data.valueDate = new Date(res.data.valueDate);
return res.data;
})
)
}
Actually how I need to change the date format of fields valuedate in array coming from API
Could you please help?
This is my service class which returns array ...Need to change the date format
getTransactions(): Observable<ITransactionResponse[]> {
return this.httpClient.get<Result<ITransactionResponse[]>>(baseUrl + '/Transaction/GetTransactions')
.pipe(map( res => res.data));
}
This is my Model:
export class ITransactionResponse {
id: number;
transactionNo?:string;
valueDate?:Date;
amount?: number;
}
EDIT:

restores.data, so why don't you also map every entry ofres.datathe way you do it in your other service? If you don't know how to iterate over a list maybe start with the basics first.