holidays/holiday.go
func GetHolidays(countryCode string, year int) ([]Holiday, error) {
	requiredCodes := []string{countryCode}
	result := []Holiday{}

	for len(requiredCodes) > 0 {
		cc := requiredCodes[0]
		hds, ok := holidayProviders[cc]
		if !ok {
			return nil, HolidayDataNotFoundError
		}

		requiredCodes = append(requiredCodes, hds.GetIncludes()...)
		result = append(result, hds.GetHolidays(year)...)

		requiredCodes = requiredCodes[1:]
	}

	sort.Sort(holidays(result))

	return result, nil
}
func GetHolidays(countryCode string, year int) ([]Holiday, error) {
	requiredCodes := []string{countryCode}
	result := []Holiday{}

	for len(requiredCodes) > 0 {
		cc := requiredCodes[0]
		hds, ok := holidayProviders[cc]
		if !ok {
			return nil, HolidayDataNotFoundError
		}

		requiredCodes = append(requiredCodes, hds.GetIncludes()...)
		result = append(result, hds.GetHolidays(year)...)

		requiredCodes = requiredCodes[1:]
	}

	sort.Sort(holidays(result))

	return result, nil
}
func GetHolidays ( countryCode string , year int ) ( [ ] Holiday , error ) { requiredCodes := [ ] string { countryCode } result := [ ] Holiday { } for len ( requiredCodes ) > 0 { cc := requiredCodes [ 0 ] hds , ok := holidayProviders [ cc ] if ! ok { return nil , HolidayDataNotFoundError } requiredCodes = append ( requiredCodes , hds . GetIncludes ( ) ... ) result = append ( result , hds . GetHolidays ( year ) ... ) requiredCodes = requiredCodes [ 1 : ] } sort . Sort ( holidays ( result ) ) return result , nil }
// GetHolidays returns the holidays for the given ISO 3166-2 countryCode and year
GetHolidays returns the holidays for the given ISO 3166 - 2 countryCode and year