Fixed bug: ExcelSheet timezone conversion doesn't take DST into account.

This commit is contained in:
Mantas 2019-10-28 13:41:55 +02:00 committed by Thorsten Eckel
parent d2912ff25f
commit f17c181427

View file

@ -5,7 +5,6 @@ class ExcelSheet
@header = header @header = header
@records = records @records = records
@timezone = timezone.presence || Setting.get('timezone_default') @timezone = timezone.presence || Setting.get('timezone_default')
@timezone_offset = @timezone.present? ? Time.now.in_time_zone(@timezone).utc_offset : 0
@locale = locale || 'en-en' @locale = locale || 'en-en'
@tempfile = Tempfile.new('excel-export.xls') @tempfile = Tempfile.new('excel-export.xls')
@workbook = WriteExcel.new(@tempfile) @workbook = WriteExcel.new(@tempfile)
@ -113,7 +112,7 @@ class ExcelSheet
def timestamp_in_localtime(time) def timestamp_in_localtime(time)
return if time.blank? return if time.blank?
(time + @timezone_offset).utc.strftime('%F %T') # "2019-08-19 16:21:52" time.in_time_zone(@timezone).strftime('%F %T') # "2019-08-19 16:21:52"
end end
def value_lookup(record, attribute, additional) def value_lookup(record, attribute, additional)