mirror of
https://gitee.com/dromara/carbon.git
synced 2024-11-29 18:57:37 +08:00
修复进行 UnmarshalJSON 时时区错误的 bug
This commit is contained in:
parent
e69a5e300a
commit
d45e1b5266
@ -9,12 +9,12 @@ import (
|
||||
func TestCarbon_SetDefault(t *testing.T) {
|
||||
SetDefault(Default{
|
||||
Layout: DateTimeLayout,
|
||||
Timezone: Local,
|
||||
Timezone: PRC,
|
||||
Locale: "en",
|
||||
WeekStartsAt: Sunday,
|
||||
})
|
||||
assert.Equal(t, DateTimeLayout, defaultLayout)
|
||||
assert.Equal(t, Local, defaultTimezone)
|
||||
assert.Equal(t, PRC, defaultTimezone)
|
||||
assert.Equal(t, "en", defaultLocale)
|
||||
assert.Equal(t, "Sunday", defaultWeekStartsAt)
|
||||
}
|
||||
|
@ -424,6 +424,6 @@ func TestCarbon_Issue243(t *testing.T) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, "Local", project.StartDate.Location())
|
||||
assert.Equal(t, "Local", project.EndDate.Location())
|
||||
assert.Equal(t, "PRC", project.StartDate.Location())
|
||||
assert.Equal(t, "PRC", project.EndDate.Location())
|
||||
}
|
||||
|
@ -54,18 +54,18 @@ func TestCarbon_GoString(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "case2",
|
||||
actual: Parse("0000-01-01 13:14:15").GoString(),
|
||||
want: "time.Date(0, time.January, 1, 13, 14, 15, 0, time.Local)",
|
||||
actual: Parse("0000-01-01 13:14:15", UTC).GoString(),
|
||||
want: "time.Date(0, time.January, 1, 13, 14, 15, 0, time.UTC)",
|
||||
},
|
||||
{
|
||||
name: "case3",
|
||||
actual: Parse("0001-01-01 13:14:15").GoString(),
|
||||
want: "time.Date(1, time.January, 1, 13, 14, 15, 0, time.Local)",
|
||||
actual: Parse("0001-01-01 13:14:15", UTC).GoString(),
|
||||
want: "time.Date(1, time.January, 1, 13, 14, 15, 0, time.UTC)",
|
||||
},
|
||||
{
|
||||
name: "case4",
|
||||
actual: Parse("2020-08-05 13:14:15").GoString(),
|
||||
want: "time.Date(2020, time.August, 5, 13, 14, 15, 0, time.Local)",
|
||||
actual: Parse("2020-08-05 13:14:15", UTC).GoString(),
|
||||
want: "time.Date(2020, time.August, 5, 13, 14, 15, 0, time.UTC)",
|
||||
},
|
||||
}
|
||||
|
||||
@ -2652,7 +2652,7 @@ func TestCarbon_ToStdTime(t *testing.T) {
|
||||
assert.Equal(t, expected, actual)
|
||||
}
|
||||
|
||||
// https://github.com/golang-module/carbon/issues/200
|
||||
// https://github.com/dromara/carbon/issues/200
|
||||
func TestCarbon_Issue200(t *testing.T) {
|
||||
tests1 := []struct {
|
||||
name string
|
||||
|
Loading…
Reference in New Issue
Block a user