Follow up for issue #2697 - Time zone incorrectly calculated in ticket list.
This commit is contained in:
parent
31cd45d0a4
commit
19ca528635
2 changed files with 7 additions and 2 deletions
|
@ -466,8 +466,9 @@ class TimeAccountingsController < ApplicationController
|
||||||
|
|
||||||
if timezone.present?
|
if timezone.present?
|
||||||
offset = time.in_time_zone(timezone).utc_offset
|
offset = time.in_time_zone(timezone).utc_offset
|
||||||
time -= offset
|
time += offset
|
||||||
end
|
end
|
||||||
time.utc.iso8601.to_s.sub(/Z$/, '')
|
local_time = time.utc.iso8601.to_s.sub(/Z$/, '')
|
||||||
|
local_time.sub(/T/, ' ')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -61,5 +61,9 @@ RSpec.describe 'Time Accounting API endpoints', type: :request do
|
||||||
expect(response['Content-Type']).to eq('application/vnd.ms-excel')
|
expect(response['Content-Type']).to eq('application/vnd.ms-excel')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does convert UTC timestamp to local system based timestamp' do
|
||||||
|
expect(TimeAccountingsController.new.instance_eval { 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
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue