Browse Source

using offsets instead, as it uses time.Unix in calculations, making UTC conversions pointless anyways

Daniel Sont 9 năm trước cách đây
mục cha
commit
e0107c0966
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  1. 3 1
      cell.go

+ 3 - 1
cell.go

@@ -152,7 +152,9 @@ func (c *Cell) SetDateTime(t time.Time) {
 
 // SetDateWithOptions allows for more granular control when exporting dates and times
 func (c *Cell) SetDateWithOptions(t time.Time, options DateTimeOptions) {
-	c.SetDateTimeWithFormat(timeToExcelTime(t.In(options.Location)), options.ExcelTimeFormat)
+	_, offset := t.Zone()
+	t = time.Unix(t.Unix()+int64(offset), t.UnixNano())
+	c.SetDateTimeWithFormat(timeToExcelTime(t.In(timeLocationUTC)), options.ExcelTimeFormat)
 }
 
 func (c *Cell) SetDateTimeWithFormat(n float64, format string) {