Skip to content

Commit

Permalink
Add Kazakhstan (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
tinohager authored Mar 17, 2024
1 parent 5afb0be commit a17de56
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 0 deletions.
141 changes: 141 additions & 0 deletions src/Nager.Date/HolidayProviders/KazakhstanHolidayProvider.cs
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"
};
}
}
}
1 change: 1 addition & 0 deletions src/Nager.Date/HolidaySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public static class HolidaySystem
{ CountryCode.JM, new Lazy<IHolidayProvider>(() => new JamaicaHolidayProvider(_catholicProvider))},
{ CountryCode.JP, new Lazy<IHolidayProvider>(() => new JapanHolidayProvider())},
{ CountryCode.KR, new Lazy<IHolidayProvider>(() => new SouthKoreaHolidayProvider())},
{ CountryCode.KZ, new Lazy<IHolidayProvider>(() => new KazakhstanHolidayProvider(_orthodoxProvider))},
{ CountryCode.MA, new Lazy<IHolidayProvider>(() => new MoroccoHolidayProvider())},
{ CountryCode.MC, new Lazy<IHolidayProvider>(() => new MonacoHolidayProvider(_catholicProvider))},
{ CountryCode.MD, new Lazy<IHolidayProvider>(() => new MoldovaHolidayProvider(_orthodoxProvider))},
Expand Down

0 comments on commit a17de56

Please sign in to comment.