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

github.com/tobiwild/holidays

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/tobiwild/holidays

  • v0.0.0-20171107183447-ff2c4f3f02f3
  • Source
  • Go
  • Socket score

Version published
Created
Source

golang holidays Build Status

With this GOLANG package it is possible to check for holidays on given Time

Installation

go get github.com/tobiwild/holidays

Usage

package main

import (
	"fmt"
	. "github.com/tobiwild/holidays"
	"time"
)

func main() {
	SetHolidaysFunction(Holidays_DE)
	date := time.Date(2009, time.January, 1, 0, 0, 0, 0, time.UTC)

	holidays := GetHolidays(date)
	for _, holiday := range holidays {
		fmt.Println(date, "is", holiday.Name)
	}

	printHolidayInfo(date)
	date = date.AddDate(0, 0, 1)
	printHolidayInfo(date)
}

func printHolidayInfo(t time.Time) {
	if IsHoliday(t) {
		fmt.Println(t, "is a holiday")
	} else {
		fmt.Println(t, "is not a holiday")
	}
}

Output:

2009-01-01 00:00:00 +0000 UTC is Neujahrstag
2009-01-01 00:00:00 +0000 UTC is a holiday
2009-01-02 00:00:00 +0000 UTC is not a holiday

Todos

At the moment there are only these functions available:

  • Holidays_DE
  • Holidays_DE_NRW
  • HolidaysBR

It would be nice to have some more. A good place to look is the ruby holidays gem.

FAQs

Package last updated on 07 Nov 2017

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