diff --git a/os/gtime/gtime_z_unit_timezone_issue_test.go b/os/gtime/gtime_z_unit_timezone_issue_test.go index c436b43d4..62ca0774d 100644 --- a/os/gtime/gtime_z_unit_timezone_issue_test.go +++ b/os/gtime/gtime_z_unit_timezone_issue_test.go @@ -95,12 +95,12 @@ func TestTime_Issue4429_TimezonePreservation(t1 *testing.T) { gmtLocation, _ := time.LoadLocation("GMT") gmtTime := time.Date(2025, 9, 16, 11, 32, 42, 878465000, gmtLocation) gtimeGMT := gtime.NewFromTime(gmtTime) - + gmtResult := []map[string]interface{}{{"now": gtimeGMT}} var gmtNowResult []time.Time err = gconv.Structs(gmtResult, &gmtNowResult) t.AssertNil(err) - + gmtFinalTime := gmtNowResult[0] _, gmtFinalOffset := gmtFinalTime.Zone() t.Assert(gmtFinalOffset, 0) // GMT should also be preserved as 0 offset diff --git a/util/gconv/internal/converter/converter_time.go b/util/gconv/internal/converter/converter_time.go index c0d2f6747..81923c77d 100644 --- a/util/gconv/internal/converter/converter_time.go +++ b/util/gconv/internal/converter/converter_time.go @@ -142,11 +142,11 @@ func (c *Converter) GTime(anyInput any, format ...string) (*gtime.Time, error) { // This helps preserve timezone when the original gtime had timezone information result, err := gtime.StrToTime(s) if err == nil && result != nil { - // If parsing succeeded but the result is in local timezone while - // the string suggests it should be in a different timezone, + // If parsing succeeded but the result is in local timezone while + // the string suggests it should be in a different timezone, // we may need additional handling here in the future return result, nil } - + return gtime.StrToTime(s) }