How can I get day before continuously? For example, I have this HTML:
<ul>
<li (click)="prevDay()"></li>
</ul>
<div>{{day}}</div>
JS:
dayBefore() {
let now: any = new Date();
this.days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];
this.day = this.days[now.getDay() - 1];
}
This way I only get the yesterday, but I need it continuously. When I click again on the <div>{{day}}</div>
I need it to go the day before the 'yesterday' and so on.. So, Thursday, Wednesday, Tuesday, etc..
EDIT: same for today and tomorrow...