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 formatting of duration by using a number input

Oliver Güntherfa47aba58a80
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 aabc3bceaad..6f55aef5e43 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
@@ -40,7 +40,7 @@ export class WidgetTimeEntriesCurrentUserComponent extends AbstractWidgetCompone
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: this.formatNumber(duration) });
+ return this.i18n.t('js.units.hour', { count: duration });
}
return this.i18n.t('js.placeholders.default');
}
diff --git a/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.ts b/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.ts
index 969b8997810..27bdcddba5a 100644
--- a/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.ts
+++ b/frontend/src/app/shared/components/grids/widgets/time-entries/list/time-entries-list.component.ts
@@ -76,7 +76,7 @@ export abstract class WidgetTimeEntriesListComponent extends AbstractWidgetCompo
public get total():string {
const duration = this.entries.reduce((current, entry) => current + this.timezone.toHours(entry.hours), 0);
- return this.i18n.t('js.units.hour', { count: this.formatNumber(duration) });
+ return this.i18n.t('js.units.hour', { count: duration });
}
public get anyEntries():boolean {
diff --git a/modules/dashboards/spec/features/time_entries_spec.rb b/modules/dashboards/spec/features/time_entries_spec.rb
index a0b807f236b..b916ea018ef 100644
--- a/modules/dashboards/spec/features/time_entries_spec.rb
+++ b/modules/dashboards/spec/features/time_entries_spec.rb
@@ -103,7 +103,7 @@ RSpec.describe 'Time entries widget on dashboard', js: true do
within spent_time_widget.area do
expect(page)
- .to have_content "Total: 11.00"
+ .to have_content "Total: 11 h"
expect(page)
.to have_content Date.today.strftime('%m/%d/%Y')
diff --git a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
index b0254bb8eb3..f07bf42ee87 100644
--- a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
+++ b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
@@ -140,7 +140,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
expect(page).to have_selector('.fc-day-sun.fc-non-working-day')
expect(page)
- .to have_content "Total: 6.00"
+ .to have_content "Total: 6 h"
expect(page)
.to have_content visible_time_entry.spent_on.strftime('%-m/%-d')
@@ -158,7 +158,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
end
expect(page)
- .to have_content "Total: 8.00"
+ .to have_content "Total: 8 h"
expect(page)
.to have_content(last_week_visible_time_entry.spent_on.strftime('%-m/%-d'))
@@ -171,7 +171,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
end
expect(page)
- .to have_content "Total: 6.00"
+ .to have_content "Total: 6 h"
within entries_area.area do
find(".te-calendar--time-entry", match: :first).hover
@@ -228,7 +228,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
end
expect(page)
- .to have_content "Total: 10.00"
+ .to have_content "Total: 10 h"
expect(TimeEntry.count)
.to be 6
@@ -276,7 +276,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
.to have_selector('.ui-tooltip', text: "Comment: Some comment")
expect(page)
- .to have_content "Total: 13.00"
+ .to have_content "Total: 13 h"
## Hiding weekdays
entries_area.click_menu_item I18n.t('js.grid.configure')