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
Fix imports of moment-timezone
Oliver Günther0974ac0707a8
diff --git a/frontend/package-lock.json b/frontend/package-lock.jsonindex d22e5d1496a..41dd19ce50d 100644--- a/frontend/package-lock.json+++ b/frontend/package-lock.json@@ -74,7 +74,7 @@"mdx-embed": "^1.1.2","mime": "^2.5.2","moment": "^2.29.4",- "moment-timezone": "^0.5.35",+ "moment-timezone": "^0.5.43","mousetrap": "~1.6.3","ng-dynamic-component": "^6.0.0","ng2-charts": "^2.3.1",diff --git a/frontend/package.json b/frontend/package.jsonindex db676747fab..e078c555952 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -147,7 +147,7 @@"mdx-embed": "^1.1.2","mime": "^2.5.2","moment": "^2.29.4",- "moment-timezone": "^0.5.35",+ "moment-timezone": "^0.5.43","mousetrap": "~1.6.3","ng-dynamic-component": "^6.0.0","ng2-charts": "^2.3.1",diff --git a/frontend/src/app/core/config/configuration.service.ts b/frontend/src/app/core/config/configuration.service.tsindex 17a274d7be3..f9e761fd913 100644--- a/frontend/src/app/core/config/configuration.service.ts+++ b/frontend/src/app/core/config/configuration.service.ts@@ -63,6 +63,10 @@ export class ConfigurationService {return !!this.timezone();}+ public isDefaultTimezoneSet():boolean {+ return !!this.defaultTimezone();+ }+public timezone():string {return this.userPreference('timeZone');}diff --git a/frontend/src/app/core/datetime/timezone.service.ts b/frontend/src/app/core/datetime/timezone.service.tsindex 101d0a16122..cdef0e15a06 100644--- a/frontend/src/app/core/datetime/timezone.service.ts+++ b/frontend/src/app/core/datetime/timezone.service.ts@@ -34,18 +34,6 @@ import {Moment,} from 'moment';-declare module 'moment' {- interface Moment {- tz():string|undefined;-- tz(timezone:string, keepLocalTime?:boolean):Moment;-- zoneAbbr():string;-- zoneName():string;- }-}-@Injectable({ providedIn: 'root' })export class TimezoneService {constructor(diff --git a/frontend/src/app/core/state/days/day.service.ts b/frontend/src/app/core/state/days/day.service.tsindex 58e3b9c2342..10b6c81fd60 100644--- a/frontend/src/app/core/state/days/day.service.ts+++ b/frontend/src/app/core/state/days/day.service.ts@@ -9,6 +9,7 @@ import {ResourceStore,ResourceStoreService,} from 'core-app/core/state/resource-store.service';+import * as moment from 'moment-timezone';@Injectable()export class DayResourceService extends ResourceStoreService<IDay> {diff --git a/frontend/src/app/features/calendar/op-calendar.service.ts b/frontend/src/app/features/calendar/op-calendar.service.tsindex 845373979cb..e89acd098ca 100644--- a/frontend/src/app/features/calendar/op-calendar.service.ts+++ b/frontend/src/app/features/calendar/op-calendar.service.ts@@ -7,6 +7,7 @@ import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destrimport { WeekdayService } from 'core-app/core/days/weekday.service';import { DayResourceService } from 'core-app/core/state/days/day.service';import { IDay } from 'core-app/core/state/days/day.model';+import * as moment from 'moment-timezone';@Injectable()export class OpCalendarService extends UntilDestroyedMixin {diff --git a/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts b/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.tsindex c526ee74f34..f68b9375ea3 100644--- a/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts+++ b/frontend/src/app/features/team-planner/team-planner/calendar-drag-drop.service.ts@@ -11,6 +11,7 @@ import { SchemaCacheService } from 'core-app/core/schemas/schema-cache.service';import { AuthorisationService } from 'core-app/core/model-auth/model-auth.service';import { I18nService } from 'core-app/core/i18n/i18n.service';import { OpWorkPackagesCalendarService } from 'core-app/features/calendar/op-work-packages-calendar.service';+import * as moment from 'moment-timezone';@Injectable()export class CalendarDragDropService {diff --git a/frontend/src/app/features/team-planner/team-planner/planner/loading-skeleton-data.ts b/frontend/src/app/features/team-planner/team-planner/planner/loading-skeleton-data.tsindex deb127134d6..8074c3b280d 100644--- a/frontend/src/app/features/team-planner/team-planner/planner/loading-skeleton-data.ts+++ b/frontend/src/app/features/team-planner/team-planner/planner/loading-skeleton-data.ts@@ -1,3 +1,5 @@+import * as moment from 'moment-timezone';+export const skeletonResources = [{id: 'skeleton-resource-1',diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.tsindex 2c26a196e64..3a7cc1e7742 100644--- a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts@@ -132,6 +132,7 @@ import {addBackgroundEvents,removeBackgroundEvents,} from 'core-app/features/team-planner/team-planner/planner/background-events';+import * as moment from 'moment-timezone';export type TeamPlannerViewOptionKey = 'resourceTimelineWorkWeek'|'resourceTimelineWeek'|'resourceTimelineTwoWeeks';export type TeamPlannerViewOptions = { [K in TeamPlannerViewOptionKey]:RawOptionsFromRefiners<Required<ViewOptionRefiners>> };diff --git a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.ts b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.tsindex d6d533e7108..4f96bd4d6b9 100644--- a/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.ts+++ b/frontend/src/app/features/work-packages/components/filters/filter-date-value/filter-date-value.component.ts@@ -26,14 +26,19 @@// See COPYRIGHT and LICENSE files for more details.//++-import { Component, HostBinding, Input, Output } from '@angular/core';+import {+ Component,+ HostBinding,+ Input,+ Output,+} from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';-import { HalResource } from 'core-app/features/hal/resources/hal-resource';import { DebouncedEventEmitter } from 'core-app/shared/helpers/rxjs/debounced-event-emitter';import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { componentDestroyed } from '@w11k/ngx-componentdestroyed';import { TimezoneService } from 'core-app/core/datetime/timezone.service';import { QueryFilterInstanceResource } from 'core-app/features/hal/resources/query-filter-instance-resource';+import * as moment from 'moment-timezone';@Component({selector: 'op-filter-date-value',diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.tsindex 7f4d60c19b6..f684f694228 100644--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline/baseline.component.ts@@ -52,6 +52,7 @@ import {} from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service';import { validDate } from 'core-app/shared/components/datepicker/helpers/date-modal.helpers';import { baselineFilterFromValue } from 'core-app/features/work-packages/components/wp-baseline/baseline-helpers';+import * as moment from 'moment-timezone';@Component({selector: 'op-baseline',@@ -96,7 +97,7 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {date: this.I18n.t('js.label_date'),time: this.I18n.t('js.baseline.time'),help_description: this.I18n.t('js.baseline.help_description'),- timeZone: this.configuration.isTimezoneSet() ? moment().tz(this.configuration.timezone()).zoneAbbr() : 'local',+ timeZone: this.configuration.isDefaultTimezoneSet() ? moment().tz(this.configuration.defaultTimezone()).zoneAbbr() : 'local',time_description: (i:number) => this.I18n.t('js.baseline.time_description', {time: this.selectedTimezoneFormattedTime[i],days: this.daysNumber,@@ -156,10 +157,11 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {this.selectedTimes[i] = time || '00:00';this.selectedTimezoneFormattedTime[i] = timeWithZone || '00:00+00:00';} else if (value !== 'PT0S') {- const date = moment(value);+ const date = moment.tz(value, this.configuration.defaultTimezone());+this.selectedDates[i] = date.format('YYYY-MM-DD');- this.selectedTimes[i] = date.format('HH:MM');- this.selectedTimezoneFormattedTime[i] = date.format('HH:MMZ');+ this.selectedTimes[i] = date.format('HH:mm');+ this.selectedTimezoneFormattedTime[i] = date.format('HH:mmZ');}});}@@ -220,8 +222,6 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {}}--private buildBaselineFilter():string[] {switch (this.selectedFilter) {case 'oneDayAgo':diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-entry-info.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-entry-info.tsindex 9334f72bf4b..ad28ca6906a 100644--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-entry-info.ts+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-entry-info.ts@@ -28,6 +28,7 @@import { TimezoneService } from 'core-app/core/datetime/timezone.service';import { HalResource } from 'core-app/features/hal/resources/hal-resource';+import * as moment from 'moment-timezone';export class ActivityEntryInfo {public date = this.activityDate(this.activity);diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service.tsindex f709b4fc695..1d0160333af 100644--- a/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service.ts+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/view-services/wp-view-baseline.service.ts@@ -40,6 +40,7 @@ import { WeekdayService } from 'core-app/core/days/weekday.service';import { DayResourceService } from 'core-app/core/state/days/day.service';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';import { IWorkPackageTimestamp } from 'core-app/features/hal/resources/work-package-timestamp-resource';+import * as moment from 'moment-timezone';export const DEFAULT_TIMESTAMP = 'PT0S';diff --git a/frontend/src/app/shared/components/datepicker/helpers/date-modal.helpers.ts b/frontend/src/app/shared/components/datepicker/helpers/date-modal.helpers.tsindex 173059a5976..5c1f4987b62 100644--- a/frontend/src/app/shared/components/datepicker/helpers/date-modal.helpers.ts+++ b/frontend/src/app/shared/components/datepicker/helpers/date-modal.helpers.ts@@ -29,6 +29,7 @@import { DatePicker } from 'core-app/shared/components/datepicker/datepicker';import { DateOption } from 'flatpickr/dist/types/options';import { DayElement } from 'flatpickr/dist/types/instance';+import * as moment from 'moment-timezone';/*** Map the date to the internal format,diff --git a/frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.ts b/frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.tsindex bb6e4c26dbb..55bd36a2c84 100644--- a/frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.ts+++ b/frontend/src/app/shared/components/datepicker/wp-single-date-form/wp-single-date-form.component.ts@@ -68,6 +68,8 @@ import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destrimport { WorkPackageChangeset } from 'core-app/features/work-packages/components/wp-edit/work-package-changeset';import isNewResource from 'core-app/features/hal/helpers/is-new-resource';import { DateModalSchedulingService } from '../services/date-modal-scheduling.service';+import * as moment from 'moment-timezone';+@Component({selector: 'op-wp-single-date-form',diff --git a/frontend/src/app/shared/components/fields/display/field-types/wp-spent-time-display-field.module.ts b/frontend/src/app/shared/components/fields/display/field-types/wp-spent-time-display-field.module.tsindex 57a33a83f8c..b6832e86c4d 100644--- a/frontend/src/app/shared/components/fields/display/field-types/wp-spent-time-display-field.module.ts+++ b/frontend/src/app/shared/components/fields/display/field-types/wp-spent-time-display-field.module.ts@@ -34,6 +34,7 @@ import { TimeEntryCreateService } from 'core-app/shared/components/time_entries/import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';import { EstimatedTimeDisplayField } from 'core-app/shared/components/fields/display/field-types/estimated-time-display-field.module';+import * as moment from 'moment-timezone';export class WorkPackageSpentTimeDisplayField extends EstimatedTimeDisplayField {public text = {diff --git a/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.tsindex fe4a49838a3..f186d9591f1 100644--- a/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.ts+++ b/frontend/src/app/shared/components/fields/edit/field-types/days-duration-edit-field.component.ts@@ -31,6 +31,7 @@ import {Component,} from '@angular/core';import { DatePickerEditFieldComponent } from 'core-app/shared/components/fields/edit/field-types/date-picker-edit-field.component';+import * as moment from 'moment-timezone';@Component({templateUrl: './days-duration-edit-field.component.html',diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.ts b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.tsindex 80c40752222..da282cb14b6 100644--- a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.ts+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/configuration-modal/services/configuration-modal/configuration-modal.service.ts@@ -1,5 +1,6 @@import { Injectable } from '@angular/core';import { DisplayedDays } from 'core-app/features/calendar/te-calendar/te-calendar.component';+import * as moment from 'moment-timezone';@Injectable()export class TimeEntriesCurrentUserConfigurationModalService {diff --git a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu.ts b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu.tsindex c0019165181..408a82c1e73 100644--- a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu.ts+++ b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-single-context-menu.ts@@ -17,6 +17,7 @@ import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decoraimport { TimeEntryCreateService } from 'core-app/shared/components/time_entries/create/create.service';import { WpDestroyModalComponent } from 'core-app/shared/components/modals/wp-destroy-modal/wp-destroy.modal';import { WorkPackageAuthorization } from 'core-app/features/work-packages/services/work-package-authorization.service';+import * as moment from 'moment-timezone';@Directive({selector: '[wpSingleContextMenu]',diff --git a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.tsindex 6f1797f2c83..9ba0f9ed536 100644--- a/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts+++ b/frontend/src/app/shared/components/op-context-menu/wp-context-menu/wp-view-context-menu.directive.ts@@ -22,6 +22,7 @@ import { splitViewRoute } from 'core-app/features/work-packages/routing/split-viimport { WpDestroyModalComponent } from 'core-app/shared/components/modals/wp-destroy-modal/wp-destroy.modal';import isNewResource from 'core-app/features/hal/helpers/is-new-resource';import { PathHelperService } from 'core-app/core/path-helper/path-helper.service';+import * as moment from 'moment-timezone';export class WorkPackageViewContextMenu extends OpContextMenuHandler {@InjectField() protected states!:States;diff --git a/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.ts b/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.tsindex a7466ddeca4..15f8644e47e 100644--- a/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.ts+++ b/frontend/src/app/shared/components/op-non-working-days-list/op-non-working-days-list.component.ts@@ -30,6 +30,7 @@ import { opIconElement } from 'core-app/shared/helpers/op-icon-builder';import { ConfirmDialogService } from 'core-app/shared/components/modals/confirm-dialog/confirm-dialog.service';import { ConfirmDialogOptions } from '../modals/confirm-dialog/confirm-dialog.modal';import { ToastService } from 'core-app/shared/components/toaster/toast.service';+import * as moment from 'moment-timezone';export const nonWorkingDaysListSelector = 'op-non-working-days-list';diff --git a/frontend/src/typings/shims.d.ts b/frontend/src/typings/shims.d.tsindex 0267de8426d..5d1e7c667a7 100644--- a/frontend/src/typings/shims.d.ts+++ b/frontend/src/typings/shims.d.ts@@ -18,7 +18,6 @@ import { Injector } from '@angular/core';import { OpenProject } from 'core-app/core/setup/globals/openproject';import * as TLodash from 'lodash';-import * as TMoment from 'moment';import { GlobalI18n } from 'core-app/core/i18n/i18n.service';import { Dragula } from 'dragula';import { Screenfull } from 'screenfull';@@ -30,7 +29,6 @@ declare module 'core-vendor/enjoyhint';declare global {const _:typeof TLodash;- const moment:typeof TMoment;const I18n:GlobalI18n;const dragula:Dragula;}