diff --git a/src/Nager.Date/HolidayProviders/SlovakiaHolidayProvider.cs b/src/Nager.Date/HolidayProviders/SlovakiaHolidayProvider.cs index f2a4b68d..6b402a64 100644 --- a/src/Nager.Date/HolidayProviders/SlovakiaHolidayProvider.cs +++ b/src/Nager.Date/HolidayProviders/SlovakiaHolidayProvider.cs @@ -1,3 +1,4 @@ +using Nager.Date.Extensions; using Nager.Date.Models; using Nager.Date.ReligiousProviders; using System; @@ -70,13 +71,6 @@ protected override IEnumerable GetHolidaySpecifications(in HolidayTypes = HolidayTypes.Public }, new HolidaySpecification - { - Date = new DateTime(year, 9, 1), - EnglishName = "Day of the Constitution of the Slovak Republic", - LocalName = "Deň Ústavy Slovenskej republiky", - HolidayTypes = HolidayTypes.Observance - }, - new HolidaySpecification { Date = new DateTime(year, 9, 15), EnglishName = "Day of Our Lady of the Seven Sorrows", @@ -122,9 +116,37 @@ protected override IEnumerable GetHolidaySpecifications(in this._catholicProvider.EasterMonday("Veľkonočný pondelok", year) }; + holidaySpecifications.AddIfNotNull(this.DayOfTheConstitution(year)); + return holidaySpecifications; } + private HolidaySpecification DayOfTheConstitution(int year) + { + var englishName = "Day of the Constitution of the Slovak Republic"; + var localName = "Deň Ústavy Slovenskej republiky"; + var holidayDate = new DateTime(year, 9, 1); + + if (year > 2024) + { + return new HolidaySpecification + { + Date = holidayDate, + EnglishName = englishName, + LocalName = localName, + HolidayTypes = HolidayTypes.Observance + }; + } + + return new HolidaySpecification + { + Date = holidayDate, + EnglishName = englishName, + LocalName = localName, + HolidayTypes = HolidayTypes.Public + }; + } + /// public override IEnumerable GetSources() {