diff --git a/proto/col_datetime.go b/proto/col_datetime.go index 0fd373ad..65d05bd2 100644 --- a/proto/col_datetime.go +++ b/proto/col_datetime.go @@ -51,7 +51,8 @@ func (c *ColDateTime) Infer(t ColumnType) error { func (c ColDateTime) loc() *time.Location { if c.Location == nil { - return time.UTC + // Defaulting to local timezone (not UTC). + return time.Local } return c.Location } @@ -61,7 +62,7 @@ func (c ColDateTime) Row(i int) time.Time { } func (c *ColDateTime) Append(v time.Time) { - c.Data = append(c.Data, ToDateTime(v.In(c.loc()))) + c.Data = append(c.Data, ToDateTime(v)) } // LowCardinality returns LowCardinality for Enum8 . diff --git a/proto/col_datetime64.go b/proto/col_datetime64.go index 48c87356..a676ecad 100644 --- a/proto/col_datetime64.go +++ b/proto/col_datetime64.go @@ -59,11 +59,15 @@ func (c *ColDateTime64) Infer(t ColumnType) error { } func (c ColDateTime64) Row(i int) time.Time { - loc := time.UTC - if c.Location != nil { - loc = c.Location + return c.Data[i].Time(c.Precision).In(c.loc()) +} + +func (c ColDateTime64) loc() *time.Location { + if c.Location == nil { + // Defaulting to local timezone (not UTC). + return time.Local } - return c.Data[i].Time(c.Precision).In(loc) + return c.Location } func (c *ColDateTime64) Append(v time.Time) {