From f17c181427c86f6634ff63438d1eec5ab032ff0d Mon Sep 17 00:00:00 2001 From: Mantas Date: Mon, 28 Oct 2019 13:41:55 +0200 Subject: [PATCH] Fixed bug: ExcelSheet timezone conversion doesn't take DST into account. --- lib/excel_sheet.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/excel_sheet.rb b/lib/excel_sheet.rb index 6de5b33db..99e3ff710 100644 --- a/lib/excel_sheet.rb +++ b/lib/excel_sheet.rb @@ -5,7 +5,6 @@ class ExcelSheet @header = header @records = records @timezone = timezone.presence || Setting.get('timezone_default') - @timezone_offset = @timezone.present? ? Time.now.in_time_zone(@timezone).utc_offset : 0 @locale = locale || 'en-en' @tempfile = Tempfile.new('excel-export.xls') @workbook = WriteExcel.new(@tempfile) @@ -113,7 +112,7 @@ class ExcelSheet def timestamp_in_localtime(time) 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 def value_lookup(record, attribute, additional)