diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 27fd425c5..94adc4a12 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -190,6 +190,7 @@ jobs: steps: # TODO: szenius/set-timezone update to node16 + # sudo ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - name: Setup Timezone uses: szenius/set-timezone@v1.1 with: diff --git a/os/gtime/gtime_z_unit_test.go b/os/gtime/gtime_z_unit_test.go index 6b14650fe..eae6eac07 100644 --- a/os/gtime/gtime_z_unit_test.go +++ b/os/gtime/gtime_z_unit_test.go @@ -111,21 +111,14 @@ func Test_StrToTime(t *testing.T) { "02.jan.2006 15:04:05", "02.jan.2006:15:04:05", } - // Save the previous time zone - local := *time.Local - defer func() { - *time.Local = local - }() - time.Local = time.FixedZone("Asia/Shanghai", 8*3600) - for i, item := range testDateTimes { + for _, item := range testDateTimes { timeTemp, err := gtime.StrToTime(item) t.AssertNil(err) - t.Log(i) t.Assert(timeTemp.Time.Local().Format("2006-01-02 15:04:05"), "2006-01-02 15:04:05") } - // Correct date string,. + // Correct date string. var testDates = []string{ "2006.01.02", "2006.01.02 00:00",