1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-17 03:02:28 +08:00

fix: fix example function bug in datetime package

This commit is contained in:
dudaodong
2023-01-08 21:01:05 +08:00
parent 4b9b1d32c5
commit ceb134b2fd

View File

@@ -141,135 +141,135 @@ func ExampleFormatStrToTime() {
} }
func ExampleBeginOfMinute() { func ExampleBeginOfMinute() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := BeginOfMinute(input) result := BeginOfMinute(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-08 18:50:00 +0800 CST // 2023-01-08 18:50:00 +0000 UTC
} }
func ExampleEndOfMinute() { func ExampleEndOfMinute() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := EndOfMinute(input) result := EndOfMinute(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-08 18:50:59.999999999 +0800 CST // 2023-01-08 18:50:59.999999999 +0000 UTC
} }
func ExampleBeginOfHour() { func ExampleBeginOfHour() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := BeginOfHour(input) result := BeginOfHour(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-08 18:00:00 +0800 CST // 2023-01-08 18:00:00 +0000 UTC
} }
func ExampleEndOfHour() { func ExampleEndOfHour() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := EndOfHour(input) result := EndOfHour(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-08 18:59:59.999999999 +0800 CST // 2023-01-08 18:59:59.999999999 +0000 UTC
} }
func ExampleBeginOfDay() { func ExampleBeginOfDay() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := BeginOfDay(input) result := BeginOfDay(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-08 00:00:00 +0800 CST // 2023-01-08 00:00:00 +0000 UTC
} }
func ExampleEndOfDay() { func ExampleEndOfDay() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := EndOfDay(input) result := EndOfDay(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-08 23:59:59.999999999 +0800 CST // 2023-01-08 23:59:59.999999999 +0000 UTC
} }
func ExampleBeginOfWeek() { func ExampleBeginOfWeek() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := BeginOfWeek(input) result := BeginOfWeek(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-08 00:00:00 +0800 CST // 2023-01-08 00:00:00 +0000 UTC
} }
func ExampleEndOfWeek() { func ExampleEndOfWeek() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := EndOfWeek(input) result := EndOfWeek(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-14 23:59:59.999999999 +0800 CST // 2023-01-14 23:59:59.999999999 +0000 UTC
} }
func ExampleBeginOfMonth() { func ExampleBeginOfMonth() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := BeginOfMonth(input) result := BeginOfMonth(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-01 00:00:00 +0800 CST // 2023-01-01 00:00:00 +0000 UTC
} }
func ExampleEndOfMonth() { func ExampleEndOfMonth() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := EndOfMonth(input) result := EndOfMonth(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-31 23:59:59.999999999 +0800 CST // 2023-01-31 23:59:59.999999999 +0000 UTC
} }
func ExampleBeginOfYear() { func ExampleBeginOfYear() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := BeginOfYear(input) result := BeginOfYear(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-01-01 00:00:00 +0800 CST // 2023-01-01 00:00:00 +0000 UTC
} }
func ExampleEndOfYear() { func ExampleEndOfYear() {
input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.Local) input := time.Date(2023, 1, 8, 18, 50, 10, 100, time.UTC)
result := EndOfYear(input) result := EndOfYear(input)
fmt.Println(result) fmt.Println(result)
// Output: // Output:
// 2023-12-31 23:59:59.999999999 +0800 CST // 2023-12-31 23:59:59.999999999 +0000 UTC
} }
func ExampleNewUnix() { func ExampleNewUnix() {