1
0
Fork 0
mirror of https://github.com/Luzifer/go-holidays.git synced 2024-12-25 05:11:17 +00:00

Move holiday declaration to code

This commit is contained in:
Knut Ahlers 2016-11-29 00:50:53 +01:00
parent 4067a197da
commit ba0fe43284
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
20 changed files with 164 additions and 923 deletions

View file

@ -1,19 +1,26 @@
package holidays
//go:generate go-bindata -pkg $GOPACKAGE -o holidays_data.go holidays/...
import (
"errors"
"fmt"
"path"
"sort"
"strings"
"time"
yaml "gopkg.in/yaml.v2"
)
var HolidayDataNotFoundError = errors.New("Holiday data not found for requested country-code")
const day = 24 * time.Hour
var (
HolidayDataNotFoundError = errors.New("Holiday data not found for requested country-code")
holidayProviders = map[string]holidayDataSource{}
)
func registerHolidayDataSource(code string, hds holidayDataSource) {
if _, ok := holidayProviders[code]; ok {
panic(fmt.Errorf("Duplicatei definition for country code %q", code))
}
holidayProviders[code] = hds
}
// Holiday contains information about an holiday
type Holiday struct {
@ -23,46 +30,44 @@ type Holiday struct {
LocalizedName map[string]string `json:"localized_name"`
// Date contains the date in YYYY-MM-DD notation
Date string `json:"date"`
// ParsedDate is the Date as a time.Time object
ParsedDate time.Time `json:"parsed_date"`
}
type holidays []Holiday
func newHoliday(name string, localizedName map[string]string, parsedDate time.Time) Holiday {
return Holiday{
Name: name,
LocalizedName: localizedName,
Date: parsedDate.Format("2006-01-02"),
ParsedDate: parsedDate,
}
}
func (h holidays) Len() int { return len(h) }
func (h holidays) Less(i, j int) bool { return h[i].Date < h[j].Date }
func (h holidays) Swap(i, j int) { h[i], h[j] = h[j], h[i] }
func dateFromNumbers(year, month, day int) time.Time {
return time.Date(year, time.Month(month), day, 0, 0, 0, 0, time.Local)
}
type holidayDataSource interface {
GetIncludes() []string
GetHolidays(year int) []Holiday
}
// GetHolidays returns the holidays for the given ISO 3166-2 countryCode and year
func GetHolidays(countryCode string, year int) ([]Holiday, error) {
requiredFiles := []string{countryCode}
requiredCodes := []string{countryCode}
result := []Holiday{}
for len(requiredFiles) > 0 {
hdf, err := loadDataFile(requiredFiles[0])
if err != nil {
return result, err
for len(requiredCodes) > 0 {
cc := requiredCodes[0]
hds, ok := holidayProviders[cc]
if !ok {
return nil, HolidayDataNotFoundError
}
requiredFiles = append(requiredFiles, hdf.Includes...)
requiredCodes = append(requiredCodes, hds.GetIncludes()...)
result = append(result, hds.GetHolidays(year)...)
easter := GregorianEasterSunday(year)
for _, h := range hdf.Holidays.Fixed {
result = append(result, Holiday{
Name: h.Name,
LocalizedName: h.LocalizedName,
Date: time.Date(year, time.Month(h.Month), h.Day, 0, 0, 0, 0, time.Local).Format("2006-01-02"),
})
}
for _, h := range hdf.Holidays.EasterBased {
result = append(result, Holiday{
Name: h.Name,
LocalizedName: h.LocalizedName,
Date: easter.Add(time.Duration(h.Difference) * 24 * time.Hour).Format("2006-01-02"),
})
}
requiredFiles = requiredFiles[1:]
requiredCodes = requiredCodes[1:]
}
sort.Sort(holidays(result))
@ -70,34 +75,8 @@ func GetHolidays(countryCode string, year int) ([]Holiday, error) {
return result, nil
}
type holidaysDataFileEntry struct {
Name string `yaml:"name"`
LocalizedName map[string]string `yaml:"localized"`
Month int `yaml:"month"`
Day int `yaml:"day"`
Difference int `yaml:"difference"`
}
type holidays []Holiday
type holidaysDataFile struct {
Includes []string `yaml:"includes"`
Holidays struct {
Fixed []holidaysDataFileEntry `yaml:"fixed"`
EasterBased []holidaysDataFileEntry `yaml:"easter_based"`
} `yaml:"holidays"`
}
func loadDataFile(countryCode string) (holidaysDataFile, error) {
r := holidaysDataFile{}
parts := strings.Split(countryCode, "-")
if len(parts) == 1 {
parts = append(parts, "_")
}
data, err := Asset(fmt.Sprintf(path.Join("holidays", parts[0], parts[1]) + ".yaml"))
if err != nil {
return r, HolidayDataNotFoundError
}
return r, yaml.Unmarshal(data, &r)
}
func (h holidays) Len() int { return len(h) }
func (h holidays) Less(i, j int) bool { return h[i].Date < h[j].Date }
func (h holidays) Swap(i, j int) { h[i], h[j] = h[j], h[i] }

View file

@ -1,54 +0,0 @@
---
includes: []
holidays:
fixed:
- name: "New Year's Day"
localized:
de: "Neujahrstag"
month: 1
day: 1
- name: "Labor Day"
localized:
de: "Tag der Arbeit"
month: 5
day: 1
- name: "German Unity Day"
localized:
de: "Tag der Deutschen Einheit"
month: 10
day: 3
- name: "Christmas Day"
localized:
de: "Weihnachtstag"
month: 12
day: 25
- name: "Boxing Day"
localized:
de: "Zweiter Weihnachtsfeiertag"
month: 12
day: 26
easter_based:
- name: "Good Friday"
localized:
de: "Karfreitag"
difference: -2
- name: "Easter Sunday"
localized:
de: "Ostersonntag"
difference: 0
- name: "Easter Monday"
localized:
de: "Ostermontag"
difference: +1
- name: "Ascension Day"
localized:
de: "Christi Himmelfahrt"
difference: +39
- name: "Whit Monday"
localized:
de: "Pfingstmontag"
difference: +50

View file

@ -1,12 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "Reformation Day"
localized:
de: "Reformationstag"
month: 10
day: 31

View file

@ -1,3 +0,0 @@
---
includes: ["de"]

View file

@ -1,23 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "Epiphany"
localized:
de: "Heilige Drei Könige"
month: 1
day: 6
- name: "All Saints"
localized:
de: "Allerheiligen"
month: 11
day: 1
easter_based:
- name: "Corpus Christi"
localized:
de: "Fronleichnam"
difference: +60

View file

@ -1,23 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "Epiphany"
localized:
de: "Heilige Drei Könige"
month: 1
day: 6
- name: "All Saints"
localized:
de: "Allerheiligen"
month: 11
day: 1
easter_based:
- name: "Corpus Christi"
localized:
de: "Fronleichnam"
difference: +60

View file

@ -1,3 +0,0 @@
---
includes: ["de"]

View file

@ -1,11 +0,0 @@
---
includes: ["de"]
holidays:
easter_based:
- name: "Corpus Christi"
localized:
de: "Fronleichnam"
difference: +60

View file

@ -1,3 +0,0 @@
---
includes: ["de"]

View file

@ -1,12 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "Reformation Day"
localized:
de: "Reformationstag"
month: 10
day: 31

View file

@ -1,3 +0,0 @@
---
includes: ["de"]

View file

@ -1,18 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "All Saints"
localized:
de: "Allerheiligen"
month: 11
day: 1
easter_based:
- name: "Corpus Christi"
localized:
de: "Fronleichnam"
difference: +60

View file

@ -1,18 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "All Saints"
localized:
de: "Allerheiligen"
month: 11
day: 1
easter_based:
- name: "Corpus Christi"
localized:
de: "Fronleichnam"
difference: +60

View file

@ -1,3 +0,0 @@
---
includes: ["de"]

View file

@ -1,23 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "Assumption Day"
localized:
de: "Mariä Himmelfahrt"
month: 8
day: 15
- name: "All Saints"
localized:
de: "Allerheiligen"
month: 11
day: 1
easter_based:
- name: "Corpus Christi"
localized:
de: "Fronleichnam"
difference: +60

View file

@ -1,12 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "Reformation Day"
localized:
de: "Reformationstag"
month: 10
day: 31

View file

@ -1,17 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "Epiphany"
localized:
de: "Heilige Drei Könige"
month: 1
day: 6
- name: "Reformation Day"
localized:
de: "Reformationstag"
month: 10
day: 31

View file

@ -1,12 +0,0 @@
---
includes: ["de"]
holidays:
fixed:
- name: "Reformation Day"
localized:
de: "Reformationstag"
month: 10
day: 31

View file

@ -1,607 +0,0 @@
// Code generated by go-bindata.
// sources:
// holidays/de/_.yaml
// holidays/de/bb.yaml
// holidays/de/be.yaml
// holidays/de/bw.yaml
// holidays/de/by.yaml
// holidays/de/hb.yaml
// holidays/de/he.yaml
// holidays/de/hh.yaml
// holidays/de/mv.yaml
// holidays/de/ni.yaml
// holidays/de/nw.yaml
// holidays/de/rp.yaml
// holidays/de/sh.yaml
// holidays/de/sl.yaml
// holidays/de/sn.yaml
// holidays/de/st.yaml
// holidays/de/th.yaml
// DO NOT EDIT!
package holidays
import (
"bytes"
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
)
func bindataRead(data []byte, name string) ([]byte, error) {
gz, err := gzip.NewReader(bytes.NewBuffer(data))
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
var buf bytes.Buffer
_, err = io.Copy(&buf, gz)
clErr := gz.Close()
if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
}
if clErr != nil {
return nil, err
}
return buf.Bytes(), nil
}
type asset struct {
bytes []byte
info os.FileInfo
}
type bindataFileInfo struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
func (fi bindataFileInfo) Name() string {
return fi.name
}
func (fi bindataFileInfo) Size() int64 {
return fi.size
}
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}
func (fi bindataFileInfo) IsDir() bool {
return false
}
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
var _holidaysDe_Yaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x94\xd2\x4d\x6b\xdb\x40\x10\x06\xe0\xfb\xfe\x8a\xc1\x97\x1e\x8a\xc0\x1f\xb8\x50\xdd\xdc\xda\x75\xa1\x1f\x09\x24\xc1\x24\x21\x84\xb1\x76\xa4\x9d\x20\xcd\xc2\xee\x0a\x5b\xf9\xf5\x41\x76\x9c\x58\xb6\x62\x2b\xba\x2d\x1a\xde\x67\x35\x7a\xa3\x28\x52\x8a\x25\xc9\x4b\x4d\x3e\x86\xfb\x07\xa5\x8c\xcd\x59\x63\xe5\x63\xa5\x00\x52\x5e\x93\x8e\x15\x00\x40\x04\x82\x05\xc5\xd0\xfb\x4f\x2b\xb8\x25\x74\x5f\x3c\x4c\xb1\xea\x6d\x5e\x02\xe4\x36\xc1\x9c\x9f\x77\xd3\xf5\xa3\xb7\xd3\xe5\x13\x1a\xe7\x03\x66\xbb\xd1\xc2\x4a\x30\x31\x0c\x5e\x8f\x1a\xab\xdd\xe1\xcd\xf8\x8b\x4b\xeb\xba\xc4\x5f\x63\x06\x9a\x1c\x4c\xdc\x92\x38\x1c\x08\xe3\x13\xc2\x9c\x5c\x81\x02\x37\xc2\xa1\xfa\x0c\x34\xa5\x32\xf8\xc4\x90\xc0\x8c\xc5\x1c\x9b\x83\xfe\x3e\x3a\x6a\xa2\x3f\x8d\x63\x1f\x0a\xec\xb4\xb9\x05\xb1\x11\x4c\x4c\x68\xdb\xdd\x70\x5f\x19\x8e\x9b\xcc\x0f\xbb\x66\xc9\xba\x18\x77\x2b\xe2\x40\x0e\xde\xad\x94\x98\xdc\x59\xf0\x5b\x5d\x0e\x42\x1f\xc8\x3d\x2e\xd1\x1f\x75\x64\x6e\xad\x86\x5f\xae\x2e\xd2\xb9\x2b\xfc\x41\x97\x3a\xe2\x3d\x52\x73\x9a\x92\x23\x49\x28\x86\x68\xd8\x0c\x9e\x6d\x4c\xb8\x2a\xa5\x43\xf4\x45\x3d\xeb\xad\xc8\x07\xe1\xfd\xd6\xec\x7f\xb6\x73\x76\xbd\x9c\xf6\xe8\xaf\x07\x75\x9b\xf8\x84\xc4\xb3\x95\x2e\x7f\x65\x5b\x13\x86\xdf\x5c\x14\x94\xa7\x68\x5c\x68\x35\x46\xdf\x9b\xc8\xc2\x70\xe8\x78\xfd\xcb\x94\x25\xf3\xe1\xc4\x07\x8c\xfb\xea\x25\x00\x00\xff\xff\x4f\x39\x11\x5d\x1e\x04\x00\x00")
func holidaysDe_YamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDe_Yaml,
"holidays/de/_.yaml",
)
}
func holidaysDe_Yaml() (*asset, error) {
bytes, err := holidaysDe_YamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/_.yaml", size: 1054, mode: os.FileMode(436), modTime: time.Unix(1474632960, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeBbYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x5c\xca\x31\x0a\x02\x31\x10\x85\xe1\x7e\x4e\xf1\x48\x1f\x70\xb1\x9b\xda\x13\xd8\x8a\xc5\xb0\x33\xeb\x0e\x64\x33\x60\x22\x18\x4f\x2f\x8a\xdb\xf8\xba\xc7\xff\xe5\x9c\x89\xbc\xce\xe5\xa1\xd6\x18\x97\xa4\x96\xae\x44\x6b\x14\x57\x19\x8d\x89\x80\xc5\x9f\xa6\x4c\x00\x90\x51\x65\x33\x46\x3a\xdb\x12\xf7\x4d\xba\x47\xc5\x49\x46\xfa\x56\xa0\xc4\x2c\xc5\x5f\x3b\xff\x4c\xff\x78\xeb\x72\xdb\xf9\x16\xb5\xaf\x8c\xe9\xf0\xfb\x2a\x83\x71\x9c\xe8\x1d\x00\x00\xff\xff\x65\x9d\xee\x7b\x96\x00\x00\x00")
func holidaysDeBbYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeBbYaml,
"holidays/de/bb.yaml",
)
}
func holidaysDeBbYaml() (*asset, error) {
bytes, err := holidaysDeBbYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/bb.yaml", size: 150, mode: os.FileMode(436), modTime: time.Unix(1474633579, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeBeYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd5\xd5\xe5\xe2\xca\xcc\x4b\xce\x29\x4d\x49\x2d\xb6\x52\x88\x56\x4a\x49\x55\x8a\xe5\x02\x04\x00\x00\xff\xff\x0a\x6b\x4d\xfd\x16\x00\x00\x00")
func holidaysDeBeYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeBeYaml,
"holidays/de/be.yaml",
)
}
func holidaysDeBeYaml() (*asset, error) {
bytes, err := holidaysDeBeYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/be.yaml", size: 22, mode: os.FileMode(436), modTime: time.Unix(1474633355, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeBwYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\xcf\xb1\x4a\xc4\x40\x10\x06\xe0\x7e\x9e\xe2\x27\xad\x04\xbc\xe6\x8a\xed\x8e\x53\x11\x2c\x2d\x45\x64\xcc\x4e\x6e\x07\x26\xb3\x61\x37\x07\xc6\x07\xf3\x05\x7c\x31\x89\x9a\xe2\xb4\xc8\x74\x33\xfc\xc3\xc7\xdf\xb6\x2d\x91\x7a\x67\xe7\x28\x35\xe0\xa9\x89\xd2\x3c\x13\xa5\x6c\x1a\x79\xae\x81\x08\xe8\xf5\x4d\x62\x20\x00\x68\xe1\x3c\x48\x40\x73\x3b\xea\x98\xd8\xe7\xe6\xfb\x0c\x58\xee\xd8\xf4\x7d\xcd\x2d\x13\x97\xdc\xbd\xa8\xe9\x49\x70\x53\x44\xf1\xf0\xf9\xe1\x7a\x92\xf5\x67\xc8\x3e\xa5\x80\xdd\xef\x1a\x79\x0e\xd8\x5f\x32\x07\x33\x3c\xb2\xfa\x54\xb7\xa0\x83\x99\x94\xf4\xa3\xf9\x5f\xe1\x82\xd8\x2d\x9d\x84\xeb\x24\xe5\xe5\x95\xeb\xbf\x6a\xc7\x5c\xc6\x73\xc5\x31\x15\xad\x93\x6e\xb9\x77\x25\xbb\x89\x76\xc9\x79\x58\xb3\x51\xfb\x5e\x8a\x78\x27\x01\x57\xfb\x6b\xfa\x0a\x00\x00\xff\xff\x6a\x7e\x58\x6c\x65\x01\x00\x00")
func holidaysDeBwYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeBwYaml,
"holidays/de/bw.yaml",
)
}
func holidaysDeBwYaml() (*asset, error) {
bytes, err := holidaysDeBwYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/bw.yaml", size: 357, mode: os.FileMode(436), modTime: time.Unix(1474631736, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeByYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\xcf\xb1\x4a\xc4\x40\x10\x06\xe0\x7e\x9e\xe2\x27\xad\x04\xbc\xe6\x8a\xed\x8e\x53\x11\x2c\x2d\x45\x64\xcc\x4e\x6e\x07\x26\xb3\x61\x37\x07\xc6\x07\xf3\x05\x7c\x31\x89\x9a\xe2\xb4\xc8\x74\x33\xfc\xc3\xc7\xdf\xb6\x2d\x91\x7a\x67\xe7\x28\x35\xe0\xa9\x89\xd2\x3c\x13\xa5\x6c\x1a\x79\xae\x81\x08\xe8\xf5\x4d\x62\x20\x00\x68\xe1\x3c\x48\x40\x73\x3b\xea\x98\xd8\xe7\xe6\xfb\x0c\x58\xee\xd8\xf4\x7d\xcd\x2d\x13\x97\xdc\xbd\xa8\xe9\x49\x70\x53\x44\xf1\xf0\xf9\xe1\x7a\x92\xf5\x67\xc8\x3e\xa5\x80\xdd\xef\x1a\x79\x0e\xd8\x5f\x32\x07\x33\x3c\xb2\xfa\x54\xb7\xa0\x83\x99\x94\xf4\xa3\xf9\x5f\xe1\x82\xd8\x2d\x9d\x84\xeb\x24\xe5\xe5\x95\xeb\xbf\x6a\xc7\x5c\xc6\x73\xc5\x31\x15\xad\x93\x6e\xb9\x77\x25\xbb\x89\x76\xc9\x79\x58\xb3\x51\xfb\x5e\x8a\x78\x27\x01\x57\xfb\x6b\xfa\x0a\x00\x00\xff\xff\x6a\x7e\x58\x6c\x65\x01\x00\x00")
func holidaysDeByYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeByYaml,
"holidays/de/by.yaml",
)
}
func holidaysDeByYaml() (*asset, error) {
bytes, err := holidaysDeByYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/by.yaml", size: 357, mode: os.FileMode(436), modTime: time.Unix(1474633085, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeHbYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd5\xd5\xe5\xe2\xca\xcc\x4b\xce\x29\x4d\x49\x2d\xb6\x52\x88\x56\x4a\x49\x55\x8a\xe5\x02\x04\x00\x00\xff\xff\x0a\x6b\x4d\xfd\x16\x00\x00\x00")
func holidaysDeHbYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeHbYaml,
"holidays/de/hb.yaml",
)
}
func holidaysDeHbYaml() (*asset, error) {
bytes, err := holidaysDeHbYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/hb.yaml", size: 22, mode: os.FileMode(436), modTime: time.Unix(1474633355, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeHeYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x34\xca\x31\x0a\xc3\x30\x0c\x46\xe1\x5d\xa7\xf8\xf1\x5a\x0c\x9d\x3a\x78\x0d\xf4\x12\xa5\x14\xd5\x52\xb0\xc0\xb1\x8b\x95\x0c\xed\xe9\x4b\x02\x79\xeb\xfb\x62\x8c\x44\xd6\x72\xdd\x44\x3d\xe1\x11\x44\xc3\x93\xa8\xf4\x6a\xc2\x5f\x4f\x44\x80\xb2\xaf\x3a\x5e\x6f\x76\x95\x44\x00\x10\xd1\x78\xd1\x84\x30\xf5\xf1\xd9\x1c\x53\x19\xe6\xab\x85\x63\x02\xb5\x67\xae\xf6\x3b\xf5\x9e\xec\xfa\x3e\x7a\xab\x6a\xb9\x34\x5e\x4e\x2b\x36\xcf\x3a\xb4\x65\x4d\xb8\xdc\xae\xf4\x0f\x00\x00\xff\xff\xd4\xe7\x49\xa5\x91\x00\x00\x00")
func holidaysDeHeYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeHeYaml,
"holidays/de/he.yaml",
)
}
func holidaysDeHeYaml() (*asset, error) {
bytes, err := holidaysDeHeYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/he.yaml", size: 145, mode: os.FileMode(436), modTime: time.Unix(1474633760, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeHhYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd5\xd5\xe5\xe2\xca\xcc\x4b\xce\x29\x4d\x49\x2d\xb6\x52\x88\x56\x4a\x49\x55\x8a\xe5\x02\x04\x00\x00\xff\xff\x0a\x6b\x4d\xfd\x16\x00\x00\x00")
func holidaysDeHhYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeHhYaml,
"holidays/de/hh.yaml",
)
}
func holidaysDeHhYaml() (*asset, error) {
bytes, err := holidaysDeHhYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/hh.yaml", size: 22, mode: os.FileMode(436), modTime: time.Unix(1474633355, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeMvYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x5c\xca\x31\x0a\x02\x31\x10\x85\xe1\x7e\x4e\xf1\x48\x1f\x70\xb1\x9b\xda\x13\xd8\x8a\xc5\xb0\x33\xeb\x0e\x64\x33\x60\x22\x18\x4f\x2f\x8a\xdb\xf8\xba\xc7\xff\xe5\x9c\x89\xbc\xce\xe5\xa1\xd6\x18\x97\xa4\x96\xae\x44\x6b\x14\x57\x19\x8d\x89\x80\xc5\x9f\xa6\x4c\x00\x90\x51\x65\x33\x46\x3a\xdb\x12\xf7\x4d\xba\x47\xc5\x49\x46\xfa\x56\xa0\xc4\x2c\xc5\x5f\x3b\xff\x4c\xff\x78\xeb\x72\xdb\xf9\x16\xb5\xaf\x8c\xe9\xf0\xfb\x2a\x83\x71\x9c\xe8\x1d\x00\x00\xff\xff\x65\x9d\xee\x7b\x96\x00\x00\x00")
func holidaysDeMvYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeMvYaml,
"holidays/de/mv.yaml",
)
}
func holidaysDeMvYaml() (*asset, error) {
bytes, err := holidaysDeMvYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/mv.yaml", size: 150, mode: os.FileMode(436), modTime: time.Unix(1474633699, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeNiYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd5\xd5\xe5\xe2\xca\xcc\x4b\xce\x29\x4d\x49\x2d\xb6\x52\x88\x56\x4a\x49\x55\x8a\xe5\x02\x04\x00\x00\xff\xff\x0a\x6b\x4d\xfd\x16\x00\x00\x00")
func holidaysDeNiYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeNiYaml,
"holidays/de/ni.yaml",
)
}
func holidaysDeNiYaml() (*asset, error) {
bytes, err := holidaysDeNiYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/ni.yaml", size: 22, mode: os.FileMode(436), modTime: time.Unix(1474633355, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeNwYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\xcd\xb1\x4a\x05\x31\x10\x85\xe1\x7e\x9e\xe2\x90\x56\x02\x6e\x63\x91\x4e\x2e\xf8\x02\x96\x22\x32\x26\xb3\x66\x60\x76\x22\x49\x2e\x78\x7d\x7a\x59\xd9\xad\x2c\x9c\x6e\x38\x1f\xfc\x31\x46\x22\xf5\x6c\xd7\x22\x23\xe1\x25\x14\x09\xaf\x44\xb5\x99\x16\xbe\x8d\x44\x04\xac\xfa\x25\x25\x11\x00\x44\x38\x6f\x92\x10\x1e\xcd\xf0\xcc\xea\x73\x84\xdf\x01\xb0\x96\xd9\xf4\xfb\x94\xfb\x95\x43\x4a\xaf\xa2\xa6\x1f\xe2\x27\xde\x9a\xcf\x9a\xb0\x2c\xc7\x5f\xf8\x96\xb0\xec\x31\xe1\x31\xa5\xbf\xbd\xf3\xf8\xd3\xbc\xb4\xfe\x79\x1d\xb8\xd4\xae\x63\xea\x7f\xdd\xa7\xde\xdc\x44\x73\x75\xde\x4e\x5b\x74\x5d\xa5\x8b\x67\x49\xb8\x7b\xb8\xa7\x9f\x00\x00\x00\xff\xff\x01\x9e\x9b\x66\xfe\x00\x00\x00")
func holidaysDeNwYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeNwYaml,
"holidays/de/nw.yaml",
)
}
func holidaysDeNwYaml() (*asset, error) {
bytes, err := holidaysDeNwYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/nw.yaml", size: 254, mode: os.FileMode(436), modTime: time.Unix(1474633825, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeRpYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\xcd\xb1\x4a\x05\x31\x10\x85\xe1\x7e\x9e\xe2\x90\x56\x02\x6e\x63\x91\x4e\x2e\xf8\x02\x96\x22\x32\x26\xb3\x66\x60\x76\x22\x49\x2e\x78\x7d\x7a\x59\xd9\xad\x2c\x9c\x6e\x38\x1f\xfc\x31\x46\x22\xf5\x6c\xd7\x22\x23\xe1\x25\x14\x09\xaf\x44\xb5\x99\x16\xbe\x8d\x44\x04\xac\xfa\x25\x25\x11\x00\x44\x38\x6f\x92\x10\x1e\xcd\xf0\xcc\xea\x73\x84\xdf\x01\xb0\x96\xd9\xf4\xfb\x94\xfb\x95\x43\x4a\xaf\xa2\xa6\x1f\xe2\x27\xde\x9a\xcf\x9a\xb0\x2c\xc7\x5f\xf8\x96\xb0\xec\x31\xe1\x31\xa5\xbf\xbd\xf3\xf8\xd3\xbc\xb4\xfe\x79\x1d\xb8\xd4\xae\x63\xea\x7f\xdd\xa7\xde\xdc\x44\x73\x75\xde\x4e\x5b\x74\x5d\xa5\x8b\x67\x49\xb8\x7b\xb8\xa7\x9f\x00\x00\x00\xff\xff\x01\x9e\x9b\x66\xfe\x00\x00\x00")
func holidaysDeRpYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeRpYaml,
"holidays/de/rp.yaml",
)
}
func holidaysDeRpYaml() (*asset, error) {
bytes, err := holidaysDeRpYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/rp.yaml", size: 254, mode: os.FileMode(436), modTime: time.Unix(1474633869, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeShYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xd2\xd5\xd5\xe5\xe2\xca\xcc\x4b\xce\x29\x4d\x49\x2d\xb6\x52\x88\x56\x4a\x49\x55\x8a\xe5\x02\x04\x00\x00\xff\xff\x0a\x6b\x4d\xfd\x16\x00\x00\x00")
func holidaysDeShYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeShYaml,
"holidays/de/sh.yaml",
)
}
func holidaysDeShYaml() (*asset, error) {
bytes, err := holidaysDeShYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/sh.yaml", size: 22, mode: os.FileMode(436), modTime: time.Unix(1474633279, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeSlYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\xcf\x31\x4a\xc5\x40\x10\x06\xe0\x7e\x4f\xf1\x93\x56\x02\xa6\x50\x64\xbb\xc7\x13\xb1\xb1\xb2\x14\x91\x31\x3b\x71\x07\x66\x77\x1f\x3b\x1b\x30\x9e\xc7\x9b\x78\x31\x89\x98\xc2\x67\x91\xe9\x86\xf9\x87\x8f\xbf\xef\x7b\xe7\x24\x8f\x3a\x07\x36\x8f\xa7\x2e\x70\xf7\xec\x5c\x2c\x2a\x81\x16\xf3\xce\x01\x93\xbc\x73\xf0\x0e\x00\x7a\x64\x4a\xec\xd1\x1d\xcc\xe6\x74\x6a\x52\x32\x6e\x69\xe9\x7e\x8e\x80\x96\x91\x54\x3e\xb6\xf4\x3a\x61\x4d\x3f\x50\x95\xaf\x4f\xdc\x4b\x4a\xac\x13\xc5\xda\xb6\x8f\x54\x72\x8b\x1e\x37\xbf\x6b\xa0\xc5\x63\xb8\x3a\xb3\x54\xf1\x48\x92\x9b\xed\x39\x07\x55\xae\x91\x45\xe5\x8d\xf3\x19\x31\x0c\x7f\x8c\xb5\x18\x93\x35\xae\x2f\xaf\x64\xff\xfa\x1d\x4b\x3d\xcd\x86\x63\xac\x62\x4d\xf6\xdc\xbb\x5a\xb2\xb2\x8c\x31\x53\xda\xb2\x41\xa6\x89\x2b\xe7\x91\x3d\x2e\xae\x2f\xdd\x77\x00\x00\x00\xff\xff\xc6\x9d\x45\x78\x6a\x01\x00\x00")
func holidaysDeSlYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeSlYaml,
"holidays/de/sl.yaml",
)
}
func holidaysDeSlYaml() (*asset, error) {
bytes, err := holidaysDeSlYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/sl.yaml", size: 362, mode: os.FileMode(436), modTime: time.Unix(1474633929, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeSnYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x5c\xca\x31\x0a\x02\x31\x10\x85\xe1\x7e\x4e\xf1\x48\x1f\x70\xb1\x9b\xda\x13\xd8\x8a\xc5\xb0\x33\xeb\x0e\x64\x33\x60\x22\x18\x4f\x2f\x8a\xdb\xf8\xba\xc7\xff\xe5\x9c\x89\xbc\xce\xe5\xa1\xd6\x18\x97\xa4\x96\xae\x44\x6b\x14\x57\x19\x8d\x89\x80\xc5\x9f\xa6\x4c\x00\x90\x51\x65\x33\x46\x3a\xdb\x12\xf7\x4d\xba\x47\xc5\x49\x46\xfa\x56\xa0\xc4\x2c\xc5\x5f\x3b\xff\x4c\xff\x78\xeb\x72\xdb\xf9\x16\xb5\xaf\x8c\xe9\xf0\xfb\x2a\x83\x71\x9c\xe8\x1d\x00\x00\xff\xff\x65\x9d\xee\x7b\x96\x00\x00\x00")
func holidaysDeSnYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeSnYaml,
"holidays/de/sn.yaml",
)
}
func holidaysDeSnYaml() (*asset, error) {
bytes, err := holidaysDeSnYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/sn.yaml", size: 150, mode: os.FileMode(436), modTime: time.Unix(1474633699, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeStYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x84\xcd\xb1\x0a\xc2\x30\x10\xc6\xf1\xfd\x9e\xe2\x23\x7b\xc0\x22\x38\x64\xae\x20\xb8\xb9\x8a\xc3\xd1\x5c\xdb\x83\x34\x29\x6d\x05\xe3\x83\xf9\x02\xbe\x98\x54\x2c\x54\x17\x6f\xbb\xe3\x7f\xfc\xac\xb5\x44\x1a\xab\x70\xf5\x32\x3a\x9c\x8d\x17\x73\x21\x6a\x53\x50\xcf\x79\x74\x44\x40\xad\x37\xf1\x8e\x00\xc0\x22\x72\x27\x0e\x66\xdf\x6b\xdf\x72\xcc\xe6\x7d\x06\x42\xaa\x38\xe8\x7d\xe9\xe6\xf1\x73\x77\x10\x0d\xda\x08\xca\x41\x14\xc7\xe7\x23\x6a\x23\xcb\x4f\x97\xe2\xd4\x3a\x14\x9f\xd5\x73\x76\xd8\x7d\x33\x27\xa9\xd3\xd0\xf1\xa4\x29\xa2\xe4\xbf\xda\x2a\x1f\x27\x6e\x7e\xa1\xcd\x5a\xda\x16\xf4\x0a\x00\x00\xff\xff\xa7\x67\x32\xd5\xfd\x00\x00\x00")
func holidaysDeStYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeStYaml,
"holidays/de/st.yaml",
)
}
func holidaysDeStYaml() (*asset, error) {
bytes, err := holidaysDeStYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/st.yaml", size: 253, mode: os.FileMode(436), modTime: time.Unix(1474633756, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _holidaysDeThYaml = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x5c\xca\x31\x0a\x02\x31\x10\x85\xe1\x7e\x4e\xf1\x48\x1f\x70\xb1\x9b\xda\x13\xd8\x8a\xc5\xb0\x33\xeb\x0e\x64\x33\x60\x22\x18\x4f\x2f\x8a\xdb\xf8\xba\xc7\xff\xe5\x9c\x89\xbc\xce\xe5\xa1\xd6\x18\x97\xa4\x96\xae\x44\x6b\x14\x57\x19\x8d\x89\x80\xc5\x9f\xa6\x4c\x00\x90\x51\x65\x33\x46\x3a\xdb\x12\xf7\x4d\xba\x47\xc5\x49\x46\xfa\x56\xa0\xc4\x2c\xc5\x5f\x3b\xff\x4c\xff\x78\xeb\x72\xdb\xf9\x16\xb5\xaf\x8c\xe9\xf0\xfb\x2a\x83\x71\x9c\xe8\x1d\x00\x00\xff\xff\x65\x9d\xee\x7b\x96\x00\x00\x00")
func holidaysDeThYamlBytes() ([]byte, error) {
return bindataRead(
_holidaysDeThYaml,
"holidays/de/th.yaml",
)
}
func holidaysDeThYaml() (*asset, error) {
bytes, err := holidaysDeThYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "holidays/de/th.yaml", size: 150, mode: os.FileMode(436), modTime: time.Unix(1474633699, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
}
// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("AssetInfo %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"holidays/de/_.yaml": holidaysDe_Yaml,
"holidays/de/bb.yaml": holidaysDeBbYaml,
"holidays/de/be.yaml": holidaysDeBeYaml,
"holidays/de/bw.yaml": holidaysDeBwYaml,
"holidays/de/by.yaml": holidaysDeByYaml,
"holidays/de/hb.yaml": holidaysDeHbYaml,
"holidays/de/he.yaml": holidaysDeHeYaml,
"holidays/de/hh.yaml": holidaysDeHhYaml,
"holidays/de/mv.yaml": holidaysDeMvYaml,
"holidays/de/ni.yaml": holidaysDeNiYaml,
"holidays/de/nw.yaml": holidaysDeNwYaml,
"holidays/de/rp.yaml": holidaysDeRpYaml,
"holidays/de/sh.yaml": holidaysDeShYaml,
"holidays/de/sl.yaml": holidaysDeSlYaml,
"holidays/de/sn.yaml": holidaysDeSnYaml,
"holidays/de/st.yaml": holidaysDeStYaml,
"holidays/de/th.yaml": holidaysDeThYaml,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for childName := range node.Children {
rv = append(rv, childName)
}
return rv, nil
}
type bintree struct {
Func func() (*asset, error)
Children map[string]*bintree
}
var _bintree = &bintree{nil, map[string]*bintree{
"holidays": &bintree{nil, map[string]*bintree{
"de": &bintree{nil, map[string]*bintree{
"_.yaml": &bintree{holidaysDe_Yaml, map[string]*bintree{}},
"bb.yaml": &bintree{holidaysDeBbYaml, map[string]*bintree{}},
"be.yaml": &bintree{holidaysDeBeYaml, map[string]*bintree{}},
"bw.yaml": &bintree{holidaysDeBwYaml, map[string]*bintree{}},
"by.yaml": &bintree{holidaysDeByYaml, map[string]*bintree{}},
"hb.yaml": &bintree{holidaysDeHbYaml, map[string]*bintree{}},
"he.yaml": &bintree{holidaysDeHeYaml, map[string]*bintree{}},
"hh.yaml": &bintree{holidaysDeHhYaml, map[string]*bintree{}},
"mv.yaml": &bintree{holidaysDeMvYaml, map[string]*bintree{}},
"ni.yaml": &bintree{holidaysDeNiYaml, map[string]*bintree{}},
"nw.yaml": &bintree{holidaysDeNwYaml, map[string]*bintree{}},
"rp.yaml": &bintree{holidaysDeRpYaml, map[string]*bintree{}},
"sh.yaml": &bintree{holidaysDeShYaml, map[string]*bintree{}},
"sl.yaml": &bintree{holidaysDeSlYaml, map[string]*bintree{}},
"sn.yaml": &bintree{holidaysDeSnYaml, map[string]*bintree{}},
"st.yaml": &bintree{holidaysDeStYaml, map[string]*bintree{}},
"th.yaml": &bintree{holidaysDeThYaml, map[string]*bintree{}},
}},
}},
}}
// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
if err != nil {
return err
}
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
if err != nil {
return err
}
return nil
}
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
}
func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}

119
holidays_de.go Normal file
View file

@ -0,0 +1,119 @@
package holidays
func init() {
registerHolidayDataSource("de", holidaysDENational{})
registerHolidayDataSource("de-bb", holidaysDEBB{})
registerHolidayDataSource("de-be", holidaysDEBE{})
registerHolidayDataSource("de-bw", holidaysDEBW{})
registerHolidayDataSource("de-by", holidaysDEBY{})
registerHolidayDataSource("de-hb", holidaysDEHB{})
registerHolidayDataSource("de-he", holidaysDEHE{})
registerHolidayDataSource("de-hh", holidaysDEHH{})
registerHolidayDataSource("de-mv", holidaysDEMV{})
registerHolidayDataSource("de-ni", holidaysDENI{})
registerHolidayDataSource("de-nw", holidaysDENW{})
registerHolidayDataSource("de-rp", holidaysDERP{})
registerHolidayDataSource("de-sh", holidaysDESH{})
registerHolidayDataSource("de-sl", holidaysDESL{})
registerHolidayDataSource("de-sn", holidaysDESN{})
registerHolidayDataSource("de-st", holidaysDEST{})
registerHolidayDataSource("de-th", holidaysDETH{})
}
type holidaysDENational struct{}
func (h holidaysDENational) GetIncludes() []string { return []string{} }
func (h holidaysDENational) GetHolidays(year int) []Holiday {
return []Holiday{
newHoliday("New Year's Day", map[string]string{"de": "Neujahrstag"}, dateFromNumbers(year, 1, 1)),
newHoliday("Labor Day", map[string]string{"de": "Tag der Arbeit"}, dateFromNumbers(year, 5, 1)),
newHoliday("German Unity Day", map[string]string{"de": "Tag der Deutschen Einheit"}, dateFromNumbers(year, 10, 3)),
newHoliday("Christmas Day", map[string]string{"de": "Weihnachtstag"}, dateFromNumbers(year, 12, 25)),
newHoliday("Boxing Day", map[string]string{"de": "Zweiter Weihnachtsfeiertag"}, dateFromNumbers(year, 12, 26)),
newHoliday("Good Friday", map[string]string{"de": "Karfreitag"}, GregorianEasterSunday(year).Add(-2*day)),
newHoliday("Easter Sunday", map[string]string{"de": "Ostersonntag"}, GregorianEasterSunday(year)),
newHoliday("Easter Monday", map[string]string{"de": "Ostermontag"}, GregorianEasterSunday(year).Add(1*day)),
newHoliday("Ascension Day", map[string]string{"de": "Christi Himmelfahrt"}, GregorianEasterSunday(year).Add(39*day)),
newHoliday("Whit Monday", map[string]string{"de": "Pfingstmontag"}, GregorianEasterSunday(year).Add(50*day)),
}
}
type holidaysDEBB struct{}
func (h holidaysDEBB) GetIncludes() []string { return []string{"de"} }
func (h holidaysDEBB) GetHolidays(year int) []Holiday {
return []Holiday{
newHoliday("Reformation Day", map[string]string{"de": "Reformationstag"}, dateFromNumbers(year, 10, 31)),
}
}
type holidaysDEBE struct{ holidaysDENational }
type holidaysDEBW struct{}
func (h holidaysDEBW) GetIncludes() []string { return []string{"de"} }
func (h holidaysDEBW) GetHolidays(year int) []Holiday {
return []Holiday{
newHoliday("Epiphany", map[string]string{"de": "Heilige Drei Könige"}, dateFromNumbers(year, 1, 6)),
newHoliday("All Saints", map[string]string{"de": "Allerheiligen"}, dateFromNumbers(year, 11, 1)),
newHoliday("Corpus Christi", map[string]string{"de": "Fronleichnam"}, GregorianEasterSunday(year).Add(60*day)),
}
}
type holidaysDEBY struct{ holidaysDEBW }
type holidaysDEHB struct{ holidaysDENational }
type holidaysDEHE struct{}
func (h holidaysDEHE) GetIncludes() []string { return []string{"de"} }
func (h holidaysDEHE) GetHolidays(year int) []Holiday {
return []Holiday{
newHoliday("Corpus Christi", map[string]string{"de": "Fronleichnam"}, GregorianEasterSunday(year).Add(60*day)),
}
}
type holidaysDEHH struct{ holidaysDENational }
type holidaysDEMV struct{ holidaysDEBB }
type holidaysDENI struct{ holidaysDENational }
type holidaysDENW struct{}
func (h holidaysDENW) GetIncludes() []string { return []string{"de"} }
func (h holidaysDENW) GetHolidays(year int) []Holiday {
return []Holiday{
newHoliday("All Saints", map[string]string{"de": "Allerheiligen"}, dateFromNumbers(year, 11, 1)),
newHoliday("Corpus Christi", map[string]string{"de": "Fronleichnam"}, GregorianEasterSunday(year).Add(60*day)),
}
}
type holidaysDERP struct{ holidaysDENW }
type holidaysDESH struct{ holidaysDENational }
type holidaysDESL struct{}
func (h holidaysDESL) GetIncludes() []string { return []string{"de"} }
func (h holidaysDESL) GetHolidays(year int) []Holiday {
return []Holiday{
newHoliday("Assumption Day", map[string]string{"de": "Mariä Himmelfahrt"}, dateFromNumbers(year, 8, 15)),
newHoliday("All Saints", map[string]string{"de": "Allerheiligen"}, dateFromNumbers(year, 11, 1)),
newHoliday("Corpus Christi", map[string]string{"de": "Fronleichnam"}, GregorianEasterSunday(year).Add(60*day)),
}
}
type holidaysDESN struct{ holidaysDEBB }
type holidaysDEST struct{}
func (h holidaysDEST) GetIncludes() []string { return []string{"de"} }
func (h holidaysDEST) GetHolidays(year int) []Holiday {
return []Holiday{
newHoliday("Epiphany", map[string]string{"de": "Heilige Drei Könige"}, dateFromNumbers(year, 1, 6)),
newHoliday("Reformation Day", map[string]string{"de": "Reformationstag"}, dateFromNumbers(year, 10, 31)),
}
}
type holidaysDETH struct{ holidaysDEBB }