Skip to content

Commit

Permalink
DON-918: Outside production, allow simulating a different date for ho…
Browse files Browse the repository at this point in the history
…me page testing with query string

So to see what the home page would be in 2020 with current code go to
e.g.

http://localhost:4200/?simulatedDate=2020-01-01 or
https://donate-staging.thebiggivetest.org.uk?simulatedDate=2020-01-01
  • Loading branch information
bdsl committed Nov 7, 2023
1 parent e4d8ac4 commit 6717c50
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ export class HomeComponent implements OnInit {
'https://images-production.thebiggive.org.uk/0011r00002IMRknAAH/CCampaign%20Banner/db3faeb1-d20d-4747-bb80-1ae9286336a3.jpg',
);
this.stats = this.route.snapshot.data.stats;


if (environment.environmentId !== 'production') {
const queryParams = this.route.snapshot.queryParams;

if (queryParams.simulatedDate) {
this.currentTime = new Date(queryParams.simulatedDate);
}
}
}

get highlightCardsToShow(): readonly HighlightCard[] {
Expand Down

0 comments on commit 6717c50

Please sign in to comment.