Skip to content

Commit ba88826

Browse files
committed
Slovakia - Fix Day of the Constitution before 2024
- #757
1 parent 47762a5 commit ba88826

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

src/Nager.Date/HolidayProviders/SlovakiaHolidayProvider.cs

+29-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Nager.Date.Extensions;
12
using Nager.Date.Models;
23
using Nager.Date.ReligiousProviders;
34
using System;
@@ -70,13 +71,6 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
7071
HolidayTypes = HolidayTypes.Public
7172
},
7273
new HolidaySpecification
73-
{
74-
Date = new DateTime(year, 9, 1),
75-
EnglishName = "Day of the Constitution of the Slovak Republic",
76-
LocalName = "Deň Ústavy Slovenskej republiky",
77-
HolidayTypes = HolidayTypes.Observance
78-
},
79-
new HolidaySpecification
8074
{
8175
Date = new DateTime(year, 9, 15),
8276
EnglishName = "Day of Our Lady of the Seven Sorrows",
@@ -122,9 +116,37 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
122116
this._catholicProvider.EasterMonday("Veľkonočný pondelok", year)
123117
};
124118

119+
holidaySpecifications.AddIfNotNull(this.DayOfTheConstitution(year));
120+
125121
return holidaySpecifications;
126122
}
127123

124+
private HolidaySpecification DayOfTheConstitution(int year)
125+
{
126+
var englishName = "Day of the Constitution of the Slovak Republic";
127+
var localName = "Deň Ústavy Slovenskej republiky";
128+
var holidayDate = new DateTime(year, 9, 1);
129+
130+
if (year > 2024)
131+
{
132+
return new HolidaySpecification
133+
{
134+
Date = holidayDate,
135+
EnglishName = englishName,
136+
LocalName = localName,
137+
HolidayTypes = HolidayTypes.Observance
138+
};
139+
}
140+
141+
return new HolidaySpecification
142+
{
143+
Date = holidayDate,
144+
EnglishName = englishName,
145+
LocalName = localName,
146+
HolidayTypes = HolidayTypes.Public
147+
};
148+
}
149+
128150
/// <inheritdoc/>
129151
public override IEnumerable<string> GetSources()
130152
{

0 commit comments

Comments
 (0)