diff --git a/frontend/src/app/features/calendar/op-work-packages-calendar.service.ts b/frontend/src/app/features/calendar/op-work-packages-calendar.service.ts index 2a854e746d6e..c8569e0e911c 100644 --- a/frontend/src/app/features/calendar/op-work-packages-calendar.service.ts +++ b/frontend/src/app/features/calendar/op-work-packages-calendar.service.ts @@ -147,8 +147,8 @@ export class OpWorkPackagesCalendarService extends UntilDestroyedMixin { } } - async requireNonWorkingDays(date:Date|string) { - this.nonWorkingDays = await firstValueFrom(this.dayService.requireNonWorkingYear$(date)); + async requireNonWorkingDays(start:Date|string, end:Date|string) { + this.nonWorkingDays = await firstValueFrom(this.dayService.requireNonWorkingYears$(start, end)); } isNonWorkingDay(date:Date|string):boolean { @@ -160,8 +160,7 @@ export class OpWorkPackagesCalendarService extends UntilDestroyedMixin { fetchInfo:{ start:Date, end:Date, timeZone:string }, projectIdentifier:string|undefined, ):Promise { - await this.requireNonWorkingDays(fetchInfo.start); - await this.requireNonWorkingDays(fetchInfo.end); + await this.requireNonWorkingDays(fetchInfo.start, fetchInfo.end); if (this.areFiltersEmpty && this.querySpace.query.value) { // nothing to do diff --git a/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts b/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts index 6216191458f1..8634c3795442 100644 --- a/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts +++ b/frontend/src/app/features/calendar/te-calendar/te-calendar.component.ts @@ -181,8 +181,9 @@ export class TimeEntryCalendarComponent { void this.weekdayService.loadWeekdays() .toPromise() .then(async () => { - const date = moment(new Date()).toString(); - await this.requireNonWorkingDays(date); + const startOfWeek = moment().startOf('week').format('YYYY-MM-DD'); + const endOfWeek = moment().endOf('week').format('YYYY-MM-DD'); + await this.requireNonWorkingDays(startOfWeek, endOfWeek); this.additionalOptions.hiddenDays = this.setHiddenDays(displayedDayss); this.calendarOptions$.next( this.additionalOptions, @@ -211,8 +212,8 @@ export class TimeEntryCalendarComponent { readonly dayService:DayResourceService, ) {} - async requireNonWorkingDays(date:Date|string) { - this.nonWorkingDays = await firstValueFrom(this.dayService.requireNonWorkingYear$(date)); + async requireNonWorkingDays(start:Date|string, end:Date|string) { + this.nonWorkingDays = await firstValueFrom(this.dayService.requireNonWorkingYears$(start, end)); } public calendarEventsFunction( @@ -255,8 +256,7 @@ export class TimeEntryCalendarComponent { private async buildEntries(entries:TimeEntryResource[], fetchInfo:{ start:Date, end:Date }):Promise { this.setRatio(entries); - await this.requireNonWorkingDays(fetchInfo.start); - await this.requireNonWorkingDays(fetchInfo.end); + await this.requireNonWorkingDays(fetchInfo.start, fetchInfo.end); return this.buildTimeEntryEntries(entries) .concat(this.buildAuxEntries(entries, fetchInfo)); }