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 tests

Klaus Zanders0dc7cf6eb6a8
diff --git a/modules/costs/lib/api/v3/time_entries/time_entry_representer.rb b/modules/costs/lib/api/v3/time_entries/time_entry_representer.rb
index 0b220ad1ac5..8d80dfa5543 100644
--- a/modules/costs/lib/api/v3/time_entries/time_entry_representer.rb
+++ b/modules/costs/lib/api/v3/time_entries/time_entry_representer.rb
@@ -90,12 +90,12 @@ module API
date_time_property :start_time,
exec_context: :decorator,
- getter: ->(*) { datetime_formatter.format_datetime(represented.start_timestamp) },
+ getter: ->(*) { datetime_formatter.format_datetime(represented.start_timestamp, allow_nil: true) },
if: ->(*) { TimeEntry.can_track_start_and_end_time? }
date_time_property :end_time,
exec_context: :decorator,
- getter: ->(*) { datetime_formatter.format_datetime(represented.end_timestamp) },
+ getter: ->(*) { datetime_formatter.format_datetime(represented.end_timestamp, allow_nil: true) },
if: ->(*) { TimeEntry.can_track_start_and_end_time? }
date_time_property :created_at
diff --git a/modules/costs/spec/requests/api/time_entry_resource_spec.rb b/modules/costs/spec/requests/api/time_entry_resource_spec.rb
index 7d54ce1f2f0..1cb7b195a26 100644
--- a/modules/costs/spec/requests/api/time_entry_resource_spec.rb
+++ b/modules/costs/spec/requests/api/time_entry_resource_spec.rb
@@ -345,11 +345,11 @@ RSpec.describe "API v3 time_entry resource" do
get api_v3_paths.time_entries
expect(subject.body)
- .to be_json_eql(time_entry.start_timestamp.to_json)
+ .to be_json_eql(time_entry.start_timestamp.utc.to_json)
.at_path("_embedded/elements/0/startTime")
expect(subject.body)
- .to be_json_eql(time_entry.end_timestamp.to_json)
+ .to be_json_eql(time_entry.end_timestamp.utc.to_json)
.at_path("_embedded/elements/0/endTime")
end
end