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

[#56505] Spent time widget: No rounding

Oliver Güntherf455cb0c2afc
diff --git a/config/locales/js-en.yml b/config/locales/js-en.yml
index 9b589914511..9044893f123 100644
--- a/config/locales/js-en.yml
+++ b/config/locales/js-en.yml
@@ -1176,6 +1176,7 @@ en:
child_work_packages:
one: "one child work package"
other: "%{count} work package children"
+ hour_string: "%{hours} h"
hour:
one: "1 h"
other: "%{count} h"
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 11d058436d1..b2d64952dfe 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
@@ -391,8 +391,7 @@ export class TimeEntryCalendarComponent implements AfterViewInit, OnDestroy {
classNames: DAY_SUM_CLASS_NAME,
rendering: 'background' as const,
startEditable: false,
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
- sum: this.i18n.t('js.units.hour', { count: duration }),
+ sum: this.i18n.t('js.units.hour_string', { hours: duration.toFixed(2) }),
};
}
diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user.component.ts b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user.component.ts
index baaf3f64b19..34313c1b4ec 100644
--- a/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user.component.ts
+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/current-user/time-entries-current-user.component.ts
@@ -38,10 +38,12 @@ export class WidgetTimeEntriesCurrentUserComponent extends AbstractWidgetCompone
}
public get total() {
- const duration = this.entries.reduce((current, entry) => current + this.timezone.toHours(entry.hours), 0);
+ const duration = this
+ .entries
+ .reduce((current, entry) => current + this.timezone.toHours(entry.hours), 0);
if (duration > 0) {
- return this.i18n.t('js.units.hour', { count: duration });
+ return this.i18n.t('js.units.hour_string', { hours: duration.toFixed(2)});
}
return this.i18n.t('js.placeholders.default');
}