Browse Source

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

Daniel Sont 9 years ago
parent
commit
e0107c0966
1 changed files with 3 additions and 1 deletions
  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) {