mirror of
https://gitee.com/johng/gf
synced 2026-06-06 16:21:40 +08:00
fix: 优化 Time 函数中对 *gtime.Time 的处理逻辑以确保时区信息的保留
This commit is contained in:
@ -24,11 +24,9 @@ func (c *Converter) Time(anyInput any, format ...string) (time.Time, error) {
|
||||
return v, nil
|
||||
}
|
||||
if v, ok := anyInput.(*gtime.Time); ok {
|
||||
// Handle *gtime.Time directly to preserve timezone
|
||||
if v == nil {
|
||||
return time.Time{}, nil
|
||||
if v != nil {
|
||||
return v.Time, nil
|
||||
}
|
||||
return v.Time, nil
|
||||
}
|
||||
|
||||
// Handle map inputs by extracting the first value
|
||||
|
||||
Reference in New Issue
Block a user