Browse Source

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

Mantas 5 years ago
parent
commit
f17c181427
1 changed files with 1 additions and 2 deletions
  1. 1 2
      lib/excel_sheet.rb

+ 1 - 2
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)