mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
refactor: update TestBetweenSeconds and ExampleBetweenSeconds
This commit is contained in:
1 parent
53a91cad71
commit
6fbaf2b005
3 files changed
+20
-10
No files matched your search
@@ -355,14 +355,15 @@ func ExampleIsLeapYear() {
|
||||
}
|
||||
|
||||
func ExampleBetweenSeconds() {
|
||||
now := time.Now()
|
||||
target := AddDay(now, 1)
|
||||
today := time.Now()
|
||||
tomorrow := AddDay(today, 1)
|
||||
yesterday := AddDay(today, -1)
|
||||
|
||||
now1 := time.Now()
|
||||
target1 := AddDay(now, -1)
|
||||
result1 := BetweenSeconds(today, tomorrow)
|
||||
result2 := BetweenSeconds(today, yesterday)
|
||||
|
||||
fmt.Println(BetweenSeconds(now, target))
|
||||
fmt.Println(BetweenSeconds(now1, target1))
|
||||
fmt.Println(result1)
|
||||
fmt.Println(result2)
|
||||
|
||||
// Output:
|
||||
// 86400
|
||||
|
||||
Reference in new issue
Block a user