Skip to content
Permalink
Browse files

Fixed issue #2697 - Time zone incorrectly calculated in ticket list.

  • Loading branch information...
zammad-sync authored and thorsteneckel committed Aug 9, 2019
1 parent b7bcc2a commit 31cd45d0a49e89162087e804492eca964908a565
Showing with 7 additions and 2 deletions.
  1. +3 −2 app/controllers/reports_controller.rb
  2. +4 −0 spec/requests/report_spec.rb
@@ -315,8 +315,9 @@ def time_in_localtime_for_excel(time, timezone)

if timezone.present?
offset = time.in_time_zone(timezone).utc_offset
time -= offset
time += offset
end
time.utc.iso8601.to_s.sub(/Z$/, '')
local_time = time.utc.iso8601.to_s.sub(/Z$/, '')
local_time.sub(/T/, ' ')
end
end
@@ -81,6 +81,10 @@
expect(@response['Content-Type']).to eq('application/vnd.ms-excel')
end

it 'does convert UTC timestamp to local system based timestamp' do
expect(ReportsController.new.time_in_localtime_for_excel(Time.parse('2019-08-08T01:00:05Z').in_time_zone, 'Europe/Berlin')).to eq('2019-08-08 03:00:05')
end

it 'does report example - deliver result' do
skip('No ES configured') if !SearchIndexBackend.enabled?

0 comments on commit 31cd45d

Please sign in to comment.
You can’t perform that action at this time.