this.authService.getmonthsandyear(this.id).subscribe(data => {
this.authService.startdate(this.id).subscribe(start_date_data => {
for (let a of data) {
if ( a.year && a.month !== start_date_data[0].month && start_date_data[0].year !== a.year) {
this.authService.getmonthwiseyear(a.month, a.year, this.id).subscribe(data ={
this.month.push((this.theMonths[Number(a.month - 1)]));
this.month.push(a.year); } else {}
The code above fails to execute the else loop when encountering the same month and year condition as specified in the commented-out if loop. In that template, all months belonging to the same year as the start date's year are being filtered instead of only the month of the year that matches the start month-year view image here