Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mexico - Add Holy Thursday and Good Friday #633

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/Nager.Date/HolidayProviders/MexicoHolidayProvider.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Nager.Date.Extensions;
using Nager.Date.Helpers;
using Nager.Date.Models;
using Nager.Date.ReligiousProviders;
using System;
using System.Collections.Generic;

Expand All @@ -11,11 +12,16 @@ namespace Nager.Date.HolidayProviders
/// </summary>
internal sealed class MexicoHolidayProvider : AbstractHolidayProvider
{
private readonly ICatholicProvider _catholicProvider;

/// <summary>
/// Mexico HolidayProvider
/// </summary>
public MexicoHolidayProvider() : base(CountryCode.MX)
/// <param name="catholicProvider"></param>
public MexicoHolidayProvider(
ICatholicProvider catholicProvider) : base(CountryCode.MX)
{
this._catholicProvider = catholicProvider;
}

/// <inheritdoc/>
Expand Down Expand Up @@ -89,7 +95,9 @@ protected override IEnumerable<HolidaySpecification> GetHolidaySpecifications(in
EnglishName = "Christmas Day",
LocalName = "Navidad",
HolidayTypes = HolidayTypes.Public
}
},
this._catholicProvider.MaundyThursday("Jueves Santo", year).SetHolidayTypes(HolidayTypes.Authorities | HolidayTypes.Bank | HolidayTypes.School),
this._catholicProvider.GoodFriday("Viernes Santo", year).SetHolidayTypes(HolidayTypes.Authorities | HolidayTypes.Bank | HolidayTypes.School)
};

holidaySpecifications.AddIfNotNull(this.InaugurationDay(year));
Expand Down
2 changes: 1 addition & 1 deletion src/Nager.Date/HolidaySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static class HolidaySystem
{ CountryCode.MN, new Lazy<IHolidayProvider>(() => new MongoliaHolidayProvider())},
{ CountryCode.MS, new Lazy<IHolidayProvider>(() => new MontserratHolidayProvider(_catholicProvider))},
{ CountryCode.MT, new Lazy<IHolidayProvider>(() => new MaltaHolidayProvider(_catholicProvider))},
{ CountryCode.MX, new Lazy<IHolidayProvider>(() => new MexicoHolidayProvider())},
{ CountryCode.MX, new Lazy<IHolidayProvider>(() => new MexicoHolidayProvider(_catholicProvider))},
{ CountryCode.MZ, new Lazy<IHolidayProvider>(() => new MozambiqueHolidayProvider())},
{ CountryCode.NA, new Lazy<IHolidayProvider>(() => new NamibiaHolidayProvider(_catholicProvider))},
{ CountryCode.NE, new Lazy<IHolidayProvider>(() => new NigerHolidayProvider(_catholicProvider))},
Expand Down