Skip to content

提供具有中国特色的休假安排或者工作日查询

License

Notifications You must be signed in to change notification settings

bastengao/chinese-holidays-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chinese-holidays-go

Go Reference badge

提供具有中国特色的休假安排或者工作日查询。

Install

go get github.com/bastengao/chinese-holidays-go

Usage

Bundle Query

import (
    "github.com/bastengao/chinese-holidays-go/holidays"
)

queryer, err := holidays.BundleQueryer()
if err != nil {
    panic(err)
}

d := time.Date(2019, 10, 1, 0, 0, 0, 0, china)
queryer.IsHoliday(d)    // true
queryer.IsWorkingday(d) // false

Cache Queryer is a Queryer that fetches online data and check updates every day.

queryer, err := holidays.NewCacheQueryer()
if err != nil {
    panic(err)
}

queryer.IsHoliday(d)

Multiple Queryer is a Queryer that delegates query to underlying multiple Queryers. Try each queryers in order until one returns a result.

bundleQueryer, err := holidays.BundleQueryer()
if err != nil {
    panic(err)
}

cacheQueryer, err := holidays.NewCacheQueryer()
if err != nil {
    panic(err)
}

queryer := holidays.NewMultipleQueryer(cacheQueryer, bundleQueryer)
queryer.IsHoliday(d)

Features

About

提供具有中国特色的休假安排或者工作日查询

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages