OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
check if a date is a NWD in full calendar
bsatarnejadcf5aac31f44c
diff --git a/frontend/src/app/features/calendar/op-calendar.service.ts b/frontend/src/app/features/calendar/op-calendar.service.tsindex 2a81e42ae3c..8b9ae2ad1c5 100644--- a/frontend/src/app/features/calendar/op-calendar.service.ts+++ b/frontend/src/app/features/calendar/op-calendar.service.ts@@ -35,7 +35,7 @@ export class OpCalendarService extends UntilDestroyedMixin {applyNonWorkingDay({ date }:{ date?:Date }, nonWorkingDays:IDay[]):string[] {const formatted = moment(date).format('YYYY-MM-DD');- if (date && (this.weekdayService.isNonWorkingDay(date) || nonWorkingDays.find((el) => !el.working && el.date === formatted))) {+ if (date && (this.weekdayService.isNonWorkingDay(date) || nonWorkingDays.find((el) => el.date === formatted))) {return ['fc-non-working-day'];}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.tsindex c8958223716..1e24c092143 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@@ -73,7 +73,7 @@ export class OpWorkPackagesCalendarService extends UntilDestroyedMixin {tooManyResultsText:string|null;public nonWorkingDays:IDay[] = [];-+currentWorkPackages$:Observable<WorkPackageCollectionResource> = this.querySpace.results@@ -161,6 +161,11 @@ export class OpWorkPackagesCalendarService extends UntilDestroyedMixin {.toPromise();}+ isNonWorkingDay(date:Date|string):boolean {+ const formatted = moment(date).format('YYYY-MM-DD');+ return (this.nonWorkingDays.findIndex((el) => el.date === formatted) !== -1);+ }+async updateTimeframe(fetchInfo:{ start:Date, end:Date, timeZone:string },projectIdentifier:string|undefined,diff --git a/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts b/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.tsindex 33ae9de055e..c48efea4771 100644--- a/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts+++ b/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts@@ -217,7 +217,8 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementconst due = moment(resizeInfo.event.endStr).subtract(1, 'day').toDate();const start = moment(resizeInfo.event.startStr).toDate();const wp = resizeInfo.event.extendedProps.workPackage as WorkPackageResource;- if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due))) {+ if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due)+ || this.workPackagesCalendar.isNonWorkingDay(start) || this.workPackagesCalendar.isNonWorkingDay(due))) {this.toastService.addError(this.text.cannot_drag_to_non_working_day);resizeInfo?.revert();return;@@ -227,7 +228,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementeventDrop: (dropInfo:EventDropArg) => {const start = moment(dropInfo.event.startStr).toDate();const wp = dropInfo.event.extendedProps.workPackage as WorkPackageResource;- if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start))) {+ if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.workPackagesCalendar.isNonWorkingDay(start))) {this.toastService.addError(this.text.cannot_drag_to_non_working_day);dropInfo?.revert();return;@@ -348,7 +349,8 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementprivate handleDateClicked(info:DateSelectArg) {const due = moment(info.endStr).subtract(1, 'day').toDate();- const nonWorkingDays = this.weekdayService.isNonWorkingDay(info.start) || this.weekdayService.isNonWorkingDay(due);+ const nonWorkingDays = this.weekdayService.isNonWorkingDay(info.start) || this.weekdayService.isNonWorkingDay(due)+ || this.workPackagesCalendar.isNonWorkingDay(info.start) || this.workPackagesCalendar.isNonWorkingDay(due);const defaults = {startDate: info.startStr,@@ -381,7 +383,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implementconst nonWorkingDays = new Array<{ start:Date|string, end:Date|string }>();while (currentStartDate.toString() !== currentEndDate.toString()) {- if (this.weekdayService.isNonWorkingDay(currentStartDate)) {+ if (this.weekdayService.isNonWorkingDay(currentStartDate) || this.workPackagesCalendar.isNonWorkingDay(currentStartDate)) {nonWorkingDays.push({start: moment(currentStartDate).format('YYYY-MM-DD'),end: moment(currentStartDate).add('1', 'day').format('YYYY-MM-DD'),