mirror of
https://github.com/gogf/gf.git
synced 2025-04-05 11:18:50 +08:00
os/gtime: fixed gtime ci fail (#3596)
This commit is contained in:
parent
1b23bf495a
commit
21c83670d6
1
.github/workflows/ci-main.yml
vendored
1
.github/workflows/ci-main.yml
vendored
@ -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:
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user