-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgonow_test.go
60 lines (51 loc) · 1.14 KB
/
gonow_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
54
55
56
57
58
59
60
package gonow
import (
"bytes"
"encoding/json"
"fmt"
"testing"
"time"
)
func JsonPrettyPrint(b []byte) []byte {
var out bytes.Buffer
json.Indent(&out, b, "", " ")
return out.Bytes()
}
func init() {
NewGoNow(time.Now()).FirstDayOfTheMonth()
test1 := NewGoNow(time.Now()).BringInWeekly(4)
t, _ := json.Marshal(test1)
fmt.Printf("%s", JsonPrettyPrint(t))
}
func TestMain(t *testing.T) {
goNow := GoNowInit(time.Now())
fmt.Println(goNow.Time)
fmt.Println(goNow.FirstDayOfTheMonth())
fmt.Println(goNow.FirstDayOfTheWeek())
fmt.Println(goNow.EndOfDay())
goNow.BringInWeekly(4)
/*
[
{
"Range": "2022-04-16 to 2022-04-10",
"T1": "2022-04-16T00:00:00+03:00",
"T2": "2022-04-10T00:00:00+03:00"
},
{
"Range": "2022-04-10 to 2022-04-03",
"T1": "2022-04-10T00:00:00+03:00",
"T2": "2022-04-03T00:00:00+03:00"
},
{
"Range": "2022-04-03 to 2022-03-27",
"T1": "2022-04-03T00:00:00+03:00",
"T2": "2022-03-27T00:00:00+03:00"
},
{
"Range": "2022-03-27 to 2022-03-20",
"T1": "2022-03-27T00:00:00+03:00",
"T2": "2022-03-20T00:00:00+03:00"
}
]
*/
}