v2.3.2 Scan 默认时区设置为 Local

This commit is contained in:
Peleus 2024-01-02 23:27:29 +08:00
parent e37ce1b695
commit 2bced5bf1a

View File

@ -10,7 +10,12 @@ import (
func (c *Carbon) Scan(v interface{}) error {
value, ok := v.(time.Time)
if ok {
loc := time.Local
if c.loc != nil {
loc = c.loc
}
*c = CreateFromStdTime(value)
c.loc = loc
return nil
}
return fmt.Errorf("can not convert %v to carbon", v)