Skip to content

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

Fix parsing of timestamp in case iso8601 is provided

Oliver Günther245990cf740c
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.ts
index e200167b90a..05105fb51d6 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
@@ -78,7 +78,7 @@ export class OpBaselineLegendsComponent {
}
public getFilterName() {
- const timestamp = this.wpTableBaseline.current[0].split('@');
+ const timestamp = this.wpTableBaseline.current[0].split(/[@T]/);
const filter = timestamp[0];
let dateTime = '';
const changesSince = this.I18n.t('js.baseline.legends.changes_since');
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.ts
index d9698bfe076..8cb6d1e0a48 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
@@ -152,16 +152,18 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
this.filterChange(this.filterFromSelected(this.wpTableBaseline.current));
this.wpTableBaseline.current.forEach((value, i) => {
- const [date, timeWithZone] = value.split('@');
- const time = timeWithZone.split(/[+-]/)[0];
- if (BASELINE_OPTIONS.includes(date)) {
- this.selectedDates[i] = '';
- } else {
- this.selectedDates[i] = date;
+ if (value.includes('@')) {
+ const [, timeWithZone] = value.split(/[@]/);
+ const time = timeWithZone.split(/[+-]/)[0];
+ this.selectedTimes[i] = time || '00:00';
+ this.selectedTimezoneFormattedTime[i] = timeWithZone || '00:00+00:00';
+ } else if (value !== 'PT0S') {
+ const date = moment(value);
+ 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] = time || '00:00';
- this.selectedTimezoneFormattedTime[i] = timeWithZone || '00:00+00:00';
});
}
}
@@ -226,7 +228,7 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
}
private filterFromSelected(selectedDates:string[]):string|null {
- if (selectedDates.length < 1) {
+ if (selectedDates.length < 2) {
return null;
}
@@ -235,11 +237,11 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
return first;
}
- if (selectedDates.length === 2) {
- return 'betweenTwoSpecificDates';
+ if (selectedDates[1] === DEFAULT_TIMESTAMP) {
+ return 'aSpecificDate';
}
- return 'aSpecificDate';
+ return 'betweenTwoSpecificDates';
}
private buildBaselineFilter():string[] {
@@ -250,7 +252,7 @@ export class OpBaselineComponent extends UntilDestroyedMixin implements OnInit {
case 'lastWorkingDay':
return [`${this.selectedFilter}@${this.selectedTimezoneFormattedTime[0]}`, DEFAULT_TIMESTAMP];
case 'aSpecificDate':
- return [`${this.selectedDates[0]}@${this.selectedTimezoneFormattedTime[0]}`, DEFAULT_TIMESTAMP];
+ return [`${this.selectedDates[0]}T${this.selectedTimezoneFormattedTime[0]}`, DEFAULT_TIMESTAMP];
case 'betweenTwoSpecificDates':
return [
`${this.selectedDates[0]}T${this.selectedTimezoneFormattedTime[0]}`,