fix: 优化 Time 函数中对 *gtime.Time 的处理逻辑以确保时区信息的保留

This commit is contained in:
hailaz
2025-09-18 11:57:16 +08:00
parent 12e2408819
commit 7ff9c0a522

View File

@ -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