Skip to content

Commit

Permalink
filtering by current year
Browse files Browse the repository at this point in the history
  • Loading branch information
aherrmann13 committed Jun 8, 2021
1 parent 976cbde commit bd3417f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Client/src/app/site/schedule/schedule.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export class ScheduleComponent implements OnInit {
constructor(private _client: Client) {}

ngOnInit() {
this._client.getAllEvents().subscribe(data => (this.events = this.orderDates(data)));
const currentYear = new Date().getFullYear();
this._client.getAllEvents().subscribe(data => {
this.events = this.orderDates(data).filter(evt => evt.startDate.getFullYear() >= currentYear);
});
}

private orderDates(events: Array<EventModel>): Array<EventModel> {
Expand Down

0 comments on commit bd3417f

Please sign in to comment.