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

Update lib in cmd

This commit is contained in:
Knut Ahlers 2016-09-24 14:19:01 +02:00
parent 7cac4348d5
commit ec9779f118
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 7 additions and 7 deletions

View file

@ -5,7 +5,7 @@
"Deps": [ "Deps": [
{ {
"ImportPath": "github.com/Luzifer/go-holidays", "ImportPath": "github.com/Luzifer/go-holidays",
"Rev": "afcc02270571047f0ef852f49d7abf0096fcf085" "Rev": "7cac4348d52c138f43b3e182e1d87e88a75b893a"
}, },
{ {
"ImportPath": "github.com/Luzifer/rconfig", "ImportPath": "github.com/Luzifer/rconfig",

View file

@ -18,11 +18,11 @@ var HolidayDataNotFoundError = errors.New("Holiday data not found for requested
// Holiday contains information about an holiday // Holiday contains information about an holiday
type Holiday struct { type Holiday struct {
// Name contains the english representation of the holidays name // Name contains the english representation of the holidays name
Name string Name string `json:"name"`
// LocalizedName contains a map of localizations of the name, key is a ISO 3166-2 country code without subdivision // LocalizedName contains a map of localizations of the name, key is a ISO 3166-2 country code without subdivision
LocalizedName map[string]string LocalizedName map[string]string `json:"localized_name"`
// Date contains the date with time.Local zone // Date contains the date in YYYY-MM-DD notation
Date time.Time Date string `json:"date"`
} }
type holidays []Holiday type holidays []Holiday
@ -50,7 +50,7 @@ func GetHolidays(countryCode string, year int) ([]Holiday, error) {
result = append(result, Holiday{ result = append(result, Holiday{
Name: h.Name, Name: h.Name,
LocalizedName: h.LocalizedName, LocalizedName: h.LocalizedName,
Date: time.Date(year, time.Month(h.Month), h.Day, 0, 0, 0, 0, time.Local), Date: time.Date(year, time.Month(h.Month), h.Day, 0, 0, 0, 0, time.Local).Format("2006-01-02"),
}) })
} }
@ -58,7 +58,7 @@ func GetHolidays(countryCode string, year int) ([]Holiday, error) {
result = append(result, Holiday{ result = append(result, Holiday{
Name: h.Name, Name: h.Name,
LocalizedName: h.LocalizedName, LocalizedName: h.LocalizedName,
Date: easter.Add(time.Duration(h.Difference) * 24 * time.Hour), Date: easter.Add(time.Duration(h.Difference) * 24 * time.Hour).Format("2006-01-02"),
}) })
} }