Skip to content

Commit

Permalink
three commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lsy88 committed Dec 8, 2022
1 parent 20dd178 commit afa3dae
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 36 deletions.
6 changes: 3 additions & 3 deletions date/date.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ const (
Date_4 = "2006年1月2日"
)

func init() {
func InitDate() {
web := parse.GetWeb()
url, err := parse.GetURL(web)
if err != nil {
log.Fatalln(err)
}
InitHoliday(url)
initHoliday(url)
}

func InitHoliday(url string) {
func initHoliday(url string) {
date, err := parse.Parse(url)
if err != nil {
log.Fatalf("parse html failed: %v\n", err)
Expand Down
41 changes: 41 additions & 0 deletions date_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package test

import (
"fmt"
"github.com/lsy88/date_parse/date"
"testing"
)

func TestDate(t *testing.T) {
//首先
date.InitDate()
//获取下一个节假日信息
agenday, day := date.NextBigDay("2022年6月1日", date.Date_4)
fmt.Println(agenday)
fmt.Println(day)

//新建自定义日程
date.AddBigDay("生日", "2022年6月2日", "", "今天是我的生日", true)
countdown, day := date.NextBigDay("2022年6月1日", "")
fmt.Println(countdown)
fmt.Println(day)
//fmt.Println(date.GetBigDayList())
//
date.DeleteBigDay("2022年6月2日")
countdown, day = date.NextBigDay("2022年6月1日", "")
fmt.Println(countdown)
fmt.Println(day)
fmt.Println(date.GetBigDayList())
date.AddBigDay("出去玩", "2022年4月29日", "", "出去吃饭", false)
countdown, day = date.NextBigDay("2022年4月10日", "")
fmt.Println(countdown)
fmt.Println(day)

fmt.Println(date.IsWeekDay("2022/12/04", ""))

fmt.Println(date.FetchDay("2022/12/11"))

fmt.Println(date.FetchByChName("端午节"))

fmt.Println(date.IsHoliday("2022/06/04"))
}
33 changes: 0 additions & 33 deletions main.go

This file was deleted.

0 comments on commit afa3dae

Please sign in to comment.