chinese_holidays_go

package module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2023 License: MIT Imports: 8 Imported by: 0

README

chinese-holidays-go

Install

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

Usage

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

func main() {
	inquirer := NewInquirer() // inquirer应设置成全局变量,避免每次初始化从互联网获取数据初始化
	date := time.Date(2023, 1, 2, 0, 0, 0, 0, china)
	inquirer.IsHoliday(date) // true
	inquirer.IsWorkingDay(date) // false
}

Documentation

Index

Constants

View Source
const (
	Local          = "Asia/Shanghai"
	TypeHoliday    = "holiday"
	TypeWorkingDay = "workingDay"
)
View Source
const (
	UrlPrefix = "http://chinese-holidays-data.basten.me/data"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Inquire

type Inquire struct {
	// contains filtered or unexported fields
}

func (*Inquire) IsHoliday

func (i *Inquire) IsHoliday(date time.Time) bool

IsHoliday checks given date is holiday or not. Deprecated: Use Inquirer.IsHoliday instead.

func (*Inquire) IsWorkingDay

func (i *Inquire) IsWorkingDay(date time.Time) bool

IsWorkingDay checks given date is working day or not. Deprecated: Use Inquirer.IsWorkingDay instead.

type Inquirer

type Inquirer interface {
	IsHoliday(date time.Time) bool
	IsWorkingDay(date time.Time) bool
	// contains filtered or unexported methods
}

Inquirer is the interface that wraps the Inquire method.

func NewInquirer

func NewInquirer() Inquirer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL