mirror of
https://gitee.com/johng/gf
synced 2026-06-07 02:12:11 +08:00
Apply gci import order changes
This commit is contained in:
@ -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
|
||||
|
||||
@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user