forked from Knowckx/AsukaTime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimerange_test.go
53 lines (45 loc) · 916 Bytes
/
timerange_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package asukatime
import (
"fmt"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
func Test_GetDayRange_Now(t *testing.T) {
ti := time.Now()
tr := GetDayRange(ti)
fmt.Println(tr)
}
func Test_GetWeekRange_Now(t *testing.T) {
ti := time.Now()
tr := GetWeekRange(ti)
fmt.Println(tr)
}
func Test_GetLastMonthRange_Now(t *testing.T) {
tr := GetLastMonthRange()
fmt.Println(tr)
}
func Test_GetMonthRange_Now(t *testing.T) {
ti := time.Now()
tr := GetMonthRange(ti)
fmt.Println(tr)
}
func Test_GetYearRange_Now(t *testing.T) {
ti := time.Now()
tr := GetYearRange(ti)
fmt.Println(tr)
}
func Test_NewTime(t *testing.T) {
in := "1945-10-10"
// in := "1945-10-10 12:12:12"
ti, err := NewTime(in)
assert.Nil(t, err)
fmt.Println(ti)
}
func Test_ToUnix(t *testing.T) {
in := "2021-07-30"
ti, err := NewTime(in)
assert.Nil(t, err)
ra := GetMonthRange(ti.UTC()).ToUnix()
fmt.Println(ra)
}