Если бы это был ваш компонент, это то, что вы могли бы сделать
import { Component, OnInit } from '@angular/core';
import { of } from 'rxjs';
import { max, map, mergeMap } from 'rxjs/operators';
@Component({
selector: 'hello',
template: `<h1>Hello</h1>`,
styles: [`h1 { font-family: Lato; }`]
})
export class HelloComponent implements OnInit {
fakeData = [
{
Name: "Blue",
Attributes: {
projex: [
{
dateStart: "2020-04-12T00:00:00",
Project: "50",
HeightPay: "1"
},
{
dateStart: "2020-03-05T00:00:00",
Project: "50",
},
{
dateStart: "2020-02-04T00:00:00",
Project: "50",
}
]
}
},
{
Name: "Red",
Attributes: {
projex: [
{
dateStart: "2020-04-13T00:00:00",
Project: "50",
HeightPay: "1"
},
{
dateStart: "2020-03-05T00:00:00",
Project: "50",
},
{
dateStart: "2020-02-04T00:00:00",
Project: "50",
}
]
}
}
];
fakeObservable$ = of(...this.fakeData);
ngOnInit() {
this.fakeObservable$.pipe(
mergeMap(x => x.Attributes.projex),
max((a, b) => new Date(a.dateStart) < new Date(b.dateStart) ? -1 : 1 ))
.subscribe(latest => {
var res = this.fakeData.find(x => x.Attributes.projex.find(z => z.dateStart === latest.dateStart));
console.log(res);
})
}
}