瀏覽代碼

got the TZ math working

Daniel Sont 9 年之前
父節點
當前提交
c1f377c32f
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      cell.go

+ 2 - 2
cell.go

@@ -152,8 +152,8 @@ 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) {
-	_, offset := t.Zone()
-	t = time.Unix(t.Unix()+int64(offset), t.UnixNano())
+	_, offset := t.In(options.Location).Zone()
+	t = time.Unix(t.Unix()+int64(offset), 0)
 	c.SetDateTimeWithFormat(timeToExcelTime(t.In(timeLocationUTC)), options.ExcelTimeFormat)
 }