Skip to content
Permalink
Browse files

Follow up for issue #2697 - Time zone incorrectly calculated in ticke…

…t list.
  • Loading branch information...
zammad-sync committed Aug 11, 2019
1 parent 31cd45d commit 19ca5286352a6b28e09de402824ceb5a8718a513
Showing with 7 additions and 2 deletions.
  1. +3 −2 app/controllers/time_accountings_controller.rb
  2. +4 −0 spec/requests/time_accounting_spec.rb
@@ -466,8 +466,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
@@ -61,5 +61,9 @@
expect(response['Content-Type']).to eq('application/vnd.ms-excel')
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

0 comments on commit 19ca528

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