Browse Source

got the TZ math working

Daniel Sont 9 years ago
parent
commit
c1f377c32f
1 changed files with 2 additions and 2 deletions
  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
 // SetDateWithOptions allows for more granular control when exporting dates and times
 func (c *Cell) SetDateWithOptions(t time.Time, options DateTimeOptions) {
 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)
 	c.SetDateTimeWithFormat(timeToExcelTime(t.In(timeLocationUTC)), options.ExcelTimeFormat)
 }
 }