Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/minnanalee/chinese-holidays-go

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/minnanalee/chinese-holidays-go

  • v1.5.1
  • Source
  • Go
  • Socket score

Version published
Created
Source

chinese-holidays-go

Go Reference badge

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

Minnanalee: 在原作者基础上, 增加了Holiday(time.Time)(bool, string, error)接口, Book可以导出节日名称,Book的IsHoliday,普通周末,返回false Cache、Multiple没有实现节日名称。

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

FAQs

Package last updated on 21 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc