Skip to content

Commit

Permalink
Switzerland - Fix Saint Joseph's Day (#690)
Browse files Browse the repository at this point in the history
* Switzerland - Saint Joseph's Day

- #683

* Update SwitzerlandHolidayProvider.cs
  • Loading branch information
tinohager authored Sep 30, 2024
1 parent 16bb88e commit 3ebcf8f
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions src/Nager.Date/HolidayProviders/SwitzerlandHolidayProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,6 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
SubdivisionCodes = ["CH-NE"]
},
new HolidaySpecification
{
Date = new DateTime(year, 3, 19),
EnglishName = "Saint Joseph's Day",
LocalName = "Josefstag",
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-LU", "CH-UR", "CH-SZ", "CH-NW", "CH-ZG", "CH-GR", "CH-TI", "CH-VS"]
},
new HolidaySpecification
{
Date = new DateTime(year, 5, 1),
EnglishName = "Labour Day",
Expand Down Expand Up @@ -192,6 +184,7 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in

holidaySpecifications.AddRangeIfNotNull(this.Epiphany(year));
holidaySpecifications.AddIfNotNull(this.BerchtoldsDay(year));
holidaySpecifications.AddRangeIfNotNull(this.SaintJosephsDay(year));

return holidaySpecifications;
}
Expand Down Expand Up @@ -242,6 +235,32 @@ private HolidaySpecification BerchtoldsDay(int year)
};
}

private HolidaySpecification[] SaintJosephsDay(int year)
{
var englishName = "Saint Joseph's Day";
var localName = "Josefstag";

return
[
new HolidaySpecification
{
Date = new DateTime(year, 3, 19),
EnglishName = englishName,
LocalName = localName,
HolidayTypes = HolidayTypes.Public,
SubdivisionCodes = ["CH-SZ", "CH-VS"]
},
new HolidaySpecification
{
Date = new DateTime(year, 3, 19),
EnglishName = englishName,
LocalName = localName,
HolidayTypes = HolidayTypes.Observance,
SubdivisionCodes = ["CH-LU", "CH-UR", "CH-NW", "CH-TI"]
}
];
}

/// <inheritdoc/>
public override IEnumerable<string> GetSources()
{
Expand Down

0 comments on commit 3ebcf8f

Please sign in to comment.