Skip to content

Commit

Permalink
POC-611:pre-appointment to display past year predictions (#1693)
Browse files Browse the repository at this point in the history
  • Loading branch information
Angie-540 authored Jan 5, 2024
1 parent 7ab0fdb commit e875de4
Showing 1 changed file with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,25 @@ export class PreAppointmentOutreachComponent implements OnInit {
private route: ActivatedRoute
) {
const today = new Date();
const currentWeek = this.getISOWeek(today);
const currentYear = today.getFullYear();
const startYear = 2023;
const numberOfWeeks = 52; // Set the maximum number of weeks to 52

for (let weekNumber = 1; weekNumber <= numberOfWeeks; weekNumber++) {
const weekString = `${currentYear}-W${weekNumber
.toString()
.padStart(2, '0')}`;
this.weeks.push({
label: `${currentYear}-W${weekNumber} - From ${this.getStartDate(
weekString
)} to ${this.getEndDate(weekString)}`,
value: weekString
});
for (let year = startYear; year <= currentYear; year++) {
const lastWeek = year === currentYear ? currentWeek : numberOfWeeks;
for (let weekNumber = 1; weekNumber <= lastWeek; weekNumber++) {
const weekString = `${year}-W${weekNumber.toString().padStart(2, '0')}`;
this.weeks.push({
label: `${year}-W${weekNumber} - From ${this.getStartDate(
weekString
)} to ${this.getEndDate(weekString)}`,
value: weekString
});
}
}
this.weeks.reverse();

const currentWeek = this.getISOWeek(today);
this.selectedWeek = `${currentYear}-W${currentWeek
.toString()
.padStart(2, '0')}`;
Expand Down

0 comments on commit e875de4

Please sign in to comment.