Skip to content

Commit

Permalink
Switzerland - Saint Joseph's Day
Browse files Browse the repository at this point in the history
  • Loading branch information
tinohager committed Sep 26, 2024
1 parent 9addb90 commit 2606216
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions src/Nager.Date/HolidayProviders/SwitzerlandHolidayProvider.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Nager.Date.Extensions;
using Nager.Date.Helpers;
using Nager.Date.Models;
using Nager.Date.ReligiousProviders;
Expand Down Expand Up @@ -97,14 +98,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 @@ -197,9 +190,37 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
this._catholicProvider.CorpusChristi("Fronleichnam", year).SetSubdivisionCodes("CH-LU", "CH-UR", "CH-SZ", "CH-OW", "CH-NW", "CH-ZG", "CH-AI", "CH-TI", "CH-VS", "CH-JU")
};

holidaySpecifications.AddRangeIfNotNull(this.SaintJosephsDay(year));

return holidaySpecifications;
}

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 2606216

Please sign in to comment.