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

Use format_time, not I18n.l

Oliver Günther353fd8e62378
diff --git a/modules/costs/app/components/my/time_tracking/time_entry_row.rb b/modules/costs/app/components/my/time_tracking/time_entry_row.rb
index 312d9981aa4..098d68d7e50 100644
--- a/modules/costs/app/components/my/time_tracking/time_entry_row.rb
+++ b/modules/costs/app/components/my/time_tracking/time_entry_row.rb
@@ -31,6 +31,8 @@
module My
module TimeTracking
class TimeEntryRow < OpPrimer::BorderBoxRowComponent
+ include Redmine::I18n
+
def button_links
[
action_menu
@@ -57,7 +59,7 @@ module My
end
def spent_on
- I18n.l(time_entry.spent_on)
+ format_time(time_entry.spent_on)
end
def time
@@ -158,20 +160,21 @@ module My
end
def ongoing_time
- I18n.t("label_timer_since",
- time: I18n.l(time_entry.created_at.in_time_zone(time_entry.time_zone), format: :time))
+ time = format_time(time_entry.created_at, include_date: !time_entry.created_at.today?)
+ I18n.t("label_timer_since", time:)
end
def time_range # rubocop:disable Metrics/AbcSize
return if time_entry.start_time.blank?
- times = [I18n.l(time_entry.start_timestamp, format: :time)]
+ times = [format_time(time_entry.start_timestamp, include_date: false)]
- times << if time_entry.start_timestamp.to_date == time_entry.end_timestamp.to_date
- I18n.l(time_entry.end_timestamp, format: :time)
- else
- I18n.l(time_entry.end_timestamp, format: :short)
- end
+ times <<
+ if time_entry.start_timestamp.to_date == time_entry.end_timestamp.to_date
+ format_time(time_entry.end_timestamp, include_date: false)
+ else
+ format_time(time_entry.end_timestamp, include_date: true)
+ end
times.join(" - ")
end