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 outputting zones by using moment.parseZone
Oliver Günther5c0f92bbf48f
diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-helpers.ts b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-helpers.tsindex 254f655b454..3fd1ba4d18a 100644--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-helpers.ts+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-helpers.ts@@ -36,7 +36,7 @@ export function getPartsFromTimestamp(value:string):BaselineTimestamp|null {}if (value !== 'PT0S') {- const dateObj = moment(value);+ const dateObj = moment.parseZone(value);const date = dateObj.format('YYYY-MM-DD');const time = dateObj.format('HH:mm');const offset = dateObj.format('Z');diff --git a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.tsindex 08e2f08355a..24a6d9b6bcf 100644--- a/frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts+++ b/frontend/src/app/features/work-packages/components/wp-baseline/baseline-legends/baseline-legends.component.ts@@ -105,17 +105,17 @@ export class OpBaselineLegendsComponent extends UntilDestroyedMixin implements O.live$().pipe(this.untilDestroyed(),- filter(() => this.wpTableBaseline.isActive())+ filter(() => this.wpTableBaseline.isActive()),).subscribe((timestamps) => {+ this.userTimezone = this.timezoneService.userTimezone();+ this.userOffset = moment.tz(this.userTimezone).format('Z');+const parts = getPartsFromTimestamp(timestamps[0]);if (parts) {this.offset = parts.offset;}- this.userTimezone = this.timezoneService.userTimezone();- this.userOffset = moment().tz(this.userTimezone).format('Z') as string;-this.getBaselineDetails();this.getFilterName(timestamps);this.cdRef.detectChanges();@@ -152,12 +152,12 @@ export class OpBaselineLegendsComponent extends UntilDestroyedMixin implements Odescription += ` (${upstreamDate})`;break;case 'aSpecificDate':- [upstreamDate, localDate] = this.formatUpstreamAndLocal(moment(timestamps[0]));+ [upstreamDate, localDate] = this.formatUpstreamAndLocal(moment.parseZone(timestamps[0]));description = this.I18n.t('js.baseline.drop_down.a_specific_date');description += ` (${upstreamDate})`;break;case 'betweenTwoSpecificDates':- [upstreamDate, localDate] = this.deriveDateRange(moment(timestamps[0]), moment(timestamps[1]));+ [upstreamDate, localDate] = this.deriveDateRange(moment.parseZone(timestamps[0]), moment.parseZone(timestamps[1]));description = this.I18n.t('js.baseline.drop_down.between_two_specific_dates');description += ` (${upstreamDate})`;break;@@ -171,7 +171,7 @@ export class OpBaselineLegendsComponent extends UntilDestroyedMixin implements O}private deriveSingleDate(date:string, timestamp:string):[string, string] {- const parsedDate:Moment = moment(`${date}T${timestamp}`);+ const parsedDate:Moment = moment.parseZone(`${date}T${timestamp}`);return this.formatUpstreamAndLocal(parsedDate);}