ToANSICString->ToAnsicString

This commit is contained in:
Peleus 2023-12-24 18:35:29 +08:00
parent 1cb07c3cff
commit b145cbb470
5 changed files with 11 additions and 11 deletions

View File

@ -1025,8 +1025,8 @@ carbon.Parse("2020-08-05 13:14:15.999999999").ToShortTimeMicroString() // 131415
// 输出简写时间字符串,包含纳秒
carbon.Parse("2020-08-05 13:14:15.999999999").ToShortTimeNanoString() // 131415.999999999
// 输出 ANSIC 格式字符串
carbon.Parse("2020-08-05 13:14:15").ToANSICString() // Wed Aug 5 13:14:15 2020
// 输出 Ansic 格式字符串
carbon.Parse("2020-08-05 13:14:15").ToAnsicString() // Wed Aug 5 13:14:15 2020
// 输出 Atom 格式字符串
carbon.Parse("2020-08-05 13:14:15").ToAtomString() // 2020-08-05T13:14:15+08:00
// 输出 UnixDate 格式字符串

View File

@ -1025,8 +1025,8 @@ carbon.Parse("2020-08-05 13:14:15.999999999").ToShortTimeMicroString() // 131415
// 略語時間文字列を出力,ナノ秒を含む
carbon.Parse("2020-08-05 13:14:15.999999999").ToShortTimeNanoString() // 131415.999999999
// ANSIC フォーマット文字列を出力
carbon.Parse("2020-08-05 13:14:15").ToANSICString() // Wed Aug 5 13:14:15 2020
// Ansic フォーマット文字列を出力
carbon.Parse("2020-08-05 13:14:15").ToAnsicString() // Wed Aug 5 13:14:15 2020
// Atom フォーマット文字列を出力
carbon.Parse("2020-08-05 13:14:15").ToAtomString() // 2020-08-05T13:14:15+08:00
// UnixDate フォーマット文字列を出力

View File

@ -1020,8 +1020,8 @@ carbon.Parse("2020-08-05 13:14:15.999999999").ToShortTimeMicroString() // 131415
// Output short time with nanosecond format string
carbon.Parse("2020-08-05 13:14:15.999999999").ToShortTimeNanoString() // 131415.999999999
// Output ANSIC format string
carbon.Parse("2020-08-05 13:14:15").ToANSICString() // Wed Aug 5 13:14:15 2020
// Output Ansic format string
carbon.Parse("2020-08-05 13:14:15").ToAnsicString() // Wed Aug 5 13:14:15 2020
// Output Atom format string
carbon.Parse("2020-08-05 13:14:15").ToAtomString() // 2020-08-05T13:14:15+08:00
// Output Unix date format string

View File

@ -423,9 +423,9 @@ func (c Carbon) ToAtomString(timezone ...string) string {
return c.ToRfc3339String(timezone...)
}
// ToANSICString outputs a string in "Mon Jan _2 15:04:05 2006" layout.
// ToAnsicString outputs a string in "Mon Jan _2 15:04:05 2006" layout.
// 输出 "Mon Jan _2 15:04:05 2006" 格式字符串
func (c Carbon) ToANSICString(timezone ...string) string {
func (c Carbon) ToAnsicString(timezone ...string) string {
if len(timezone) > 0 {
c.loc, c.Error = getLocationByTimezone(timezone[0])
}

View File

@ -989,7 +989,7 @@ func TestCarbon_ToAtomString(t *testing.T) {
}
}
func TestCarbon_ToANSICString(t *testing.T) {
func TestCarbon_ToAnsicString(t *testing.T) {
assert := assert.New(t)
tests := []struct {
@ -1009,13 +1009,13 @@ func TestCarbon_ToANSICString(t *testing.T) {
for index, test := range tests {
c := Parse(test.input, PRC)
assert.Nil(c.Error)
assert.Equal(test.expected, c.ToANSICString(), "Current test index is "+strconv.Itoa(index))
assert.Equal(test.expected, c.ToAnsicString(), "Current test index is "+strconv.Itoa(index))
}
for index, test := range tests {
c := Parse(test.input, PRC)
assert.Nil(c.Error)
assert.Equal(test.expected, c.ToANSICString(PRC), "Current test index is "+strconv.Itoa(index))
assert.Equal(test.expected, c.ToAnsicString(PRC), "Current test index is "+strconv.Itoa(index))
}
}