ngOnInit(): void {
this.currentDate = new Date();
this.date = this.datePipe.transform(this.currentDate, 'y-MM-dd');
this.currentDate = this.date;
}
The code snippet above is used to retrieve the current date. The task at hand involves subtracting a day from this current date in order to obtain yesterday's date.