-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
142 additions
and
0 deletions.
There are no files selected for viewing
141 changes: 141 additions & 0 deletions
141
src/Nager.Date/HolidayProviders/KazakhstanHolidayProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
using Nager.Date.Models; | ||
using Nager.Date.ReligiousProviders; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Nager.Date.HolidayProviders | ||
{ | ||
/// <summary> | ||
/// Kazakhstan HolidayProvider | ||
/// </summary> | ||
internal sealed class KazakhstanHolidayProvider : IHolidayProvider | ||
{ | ||
private readonly IOrthodoxProvider _orthodoxProvider; | ||
|
||
/// <summary> | ||
/// Kazakhstan HolidayProvider | ||
/// </summary> | ||
/// <param name="orthodoxProvider"></param> | ||
public KazakhstanHolidayProvider( | ||
IOrthodoxProvider orthodoxProvider) | ||
{ | ||
this._orthodoxProvider = orthodoxProvider; | ||
} | ||
|
||
/// <inheritdoc/> | ||
public IEnumerable<Holiday> GetHolidays(int year) | ||
{ | ||
var countryCode = CountryCode.KZ; | ||
|
||
//TODO: Last day of Hajj -> Islamic calendar | ||
|
||
var holidaySpecifications = new List<HolidaySpecification> | ||
{ | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 1, 1), | ||
EnglishName = "New Year's Day", | ||
LocalName = "Жаңа жыл", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 1, 2), | ||
EnglishName = "New Year's Day", | ||
LocalName = "Жаңа жыл", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 3, 8), | ||
EnglishName = "International Women's Day", | ||
LocalName = "Халықаралық әйелдер күні", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 3, 21), | ||
EnglishName = "Nauryz Meyramy", | ||
LocalName = "Наурыз мейрамы", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 3, 22), | ||
EnglishName = "Nauryz Meyramy", | ||
LocalName = "Наурыз мейрамы", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 3, 23), | ||
EnglishName = "Nauryz Meyramy", | ||
LocalName = "Наурыз мейрамы", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 5, 1), | ||
EnglishName = "Kazakhstan People's Unity Day", | ||
LocalName = "Қазақстан халқының", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 5, 7), | ||
EnglishName = "Defender of the Fatherland Day", | ||
LocalName = "Отан Қорғаушы күні", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 5, 9), | ||
EnglishName = "Great Patriotic War Against Fascism Victory Day", | ||
LocalName = "Жеңіс күні", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 7, 6), | ||
EnglishName = "Capital City Day", | ||
LocalName = "Астана күні", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 8, 30), | ||
EnglishName = "Constitution Day", | ||
LocalName = "Конституция күні", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 10, 25), | ||
EnglishName = "Republic Day", | ||
LocalName = "Республика күні", | ||
HolidayTypes = HolidayTypes.Public | ||
}, | ||
new HolidaySpecification | ||
{ | ||
Date = new DateTime(year, 12, 16), | ||
EnglishName = "Independence Day", | ||
LocalName = "Тәуелсіздік күні", | ||
HolidayTypes = HolidayTypes.Public | ||
} | ||
}; | ||
|
||
var holidays = HolidaySpecificationProcessor.Process(holidaySpecifications, countryCode); | ||
return holidays.OrderBy(o => o.Date); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public IEnumerable<string> GetSources() | ||
{ | ||
return new string[] | ||
{ | ||
"https://en.wikipedia.org/wiki/Public_holidays_in_Kazakhstan" | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters