/// <summary> /// Public holiday names in Italian. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string> { { NewYear(year), "Capodanno" }, { Epiphany(year), "Epifania" } }; DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(EasterMonday(easter), "Pasquetta"); var liberationDay = LiberationDay(year); if (!bHols.ContainsKey(liberationDay)) { //in 2011, Liberation Day was 25th April, the same day as Easter Monday bHols.Add(liberationDay, "Festa della Liberazione"); } bHols.Add(LabourDay(year), "Festa del Lavoro"); bHols.Add(RepublicDay(year), "Festa della Repubblica"); bHols.Add(Assumption(year), "Ferragosto"); bHols.Add(AllSaints(year), "Tutti i santi"); bHols.Add(ImmaculateConception(year), "Immacolata Concezione"); bHols.Add(Christmas(year), "Natale"); bHols.Add(StStephen(year), "Santo Stefano"); return(bHols); }
/// <summary> /// Easter Monday /// </summary> /// <param name="year">The year.</param> /// <returns>Date of in the given year.</returns> public static DateTime EasterMonday(int year) { var hol = HolidayCalculator.GetEaster(year); hol = hol.AddDays(1); return(hol); }
/// <summary> /// Pfingstmontag - Pentecost /// </summary> /// <param name="year"></param> /// <returns></returns> public static DateTime PentecostMonday(int year) { var hol = HolidayCalculator.GetEaster(year); hol = hol.AddDays((7 * 7) + 1); return(hol); }
/// <summary> /// Public holiday names in German. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string> { { NewYear(year), "Neujahr" }, { Epiphany(year), "Heilige Drei Könige" } }; DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(EasterMonday(easter), "Ostermontag"); var mayday = LabourDay(year); bHols.Add(mayday, "Staatsfeiertag"); var ascension = Ascension(easter); if (ascension == mayday) { ascension = ascension.AddSeconds(1); //ascension can fall on Mayday } bHols.Add(ascension, "Christi Himmelfahrt"); bHols.Add(PentecostMonday(easter), "Pfingstmontag"); bHols.Add(CorpusChristi(year), "Fronleichnam"); bHols.Add(Assumption(year), "Mariä Himmelfahrt"); bHols.Add(NationalDay(year), "Nationalfeiertag"); bHols.Add(AllSaints(year), "Allerheiligen"); bHols.Add(ImmaculateConception(year), "Mariä Empfängnis"); bHols.Add(Christmas(year), "Christtag"); bHols.Add(StStephen(year), "Stefanitag"); return(bHols); }
/// <summary> /// Ascension 6th Thursday after Easter /// </summary> /// <param name="year">The year.</param> /// <returns>Date of in the given year.</returns> public static DateTime Ascension(int year) { var hol = HolidayCalculator.GetEaster(year); hol = hol.AddDays(4 + (7 * 5)); return(hol); }
/// <summary> /// Good Friday (Friday before Easter) /// </summary> /// <param name="year"></param> /// <returns></returns> public static DateTime GoodFriday(int year) { DateTime hol = HolidayCalculator.GetEaster(year); hol = hol.AddDays(-2); return(hol); }
/// <summary> /// Get a list of dates for all holidays in a year. /// </summary> /// <param name="year">The year</param> /// <returns>List of public holidays</returns> public override IList <DateTime> PublicHolidays(int year) { var bHols = new List <DateTime>(); bHols.Add(NewYear(year)); DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(EasterMonday(easter)); DateTime mayday = MayDay(year); DateTime ascension = Ascension(easter); if (ascension == mayday) { ascension = ascension.AddSeconds(1); //ascension can fall on Mayday } bHols.Add(mayday); bHols.Add(ascension); bHols.Add(VictoryInEuropeDay(year)); bHols.Add(PentecostMonday(easter)); bHols.Add(National(year)); bHols.Add(Assumption(year)); bHols.Add(AllSaints(year)); bHols.Add(Armistice(year)); bHols.Add(Christmas(year)); return(bHols); }
/// <summary> /// Public holiday names in French. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string>(); bHols.Add(NewYear(year), "Nouvel An"); DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(EasterMonday(easter), "Lundi de Pâques"); DateTime mayday = MayDay(year); bHols.Add(mayday, "Fête du Travail"); DateTime ascension = Ascension(easter); if (ascension == mayday) { ascension = ascension.AddSeconds(1); //ascension can fall on Mayday } bHols.Add(ascension, "Ascension"); bHols.Add(VictoryInEuropeDay(year), "Fête de la Victoire"); bHols.Add(PentecostMonday(easter), "Lundi de Pentecôte"); bHols.Add(National(year), "Fête nationale"); bHols.Add(Assumption(year), "Assomption"); bHols.Add(AllSaints(year), "Toussaint"); bHols.Add(Armistice(year), "Jour de l'armistice"); bHols.Add(Christmas(year), "Noël"); return(bHols); }
public override IDictionary <DateTime, string> AllHolidaysName(int year) { var holidays = new Dictionary <DateTime, string> { { NewYear(year), "Neujahrstag" } }; holidays.Add(Epiphany(year), "Heilige Drei Könige"); holidays.Add(GoodFriday(year), "Karfreitag"); holidays.Add(HolidayCalculator.GetEaster(year), "Ostersonntag"); holidays.Add(EasterMonday(year), "Ostermontag"); holidays.Add(MayDay(year), "Tag der Arbeit"); holidays.Add(Ascension(year), "Christi Himmelfahrt"); holidays.Add(PentecostSunday(year), "Pfingstsonntag"); holidays.Add(PentecostMonday(year), "Pfingstmontag"); holidays.Add(CorpusChristi(year), "Fronleichnam"); // Happy cadaver holidays.Add(Assumption(year), "Mariä Himmelfahrt"); holidays.Add(GermanUnity(year), "Tag der Deutschen Einheit"); holidays.Add(Reformation(year), "Reformationstag"); holidays.Add(AllSaints(year), "Allerheiligen"); holidays.Add(Repentance(year), "Buß- und Bettag"); holidays.Add(ChristmasEve(year), "Heiligabend"); holidays.Add(Christmas(year), "Weihnachtstag"); holidays.Add(StStephen(year), "Zweiter Weihnachtsfeiertag"); holidays.Add(NewYearsEve(year), "Silvester"); return(holidays); }
/// <summary> /// Public holiday names in Norwegian. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { DateTime easter = HolidayCalculator.GetEaster(year); var bHols = new Dictionary <DateTime, string> { { NewYear(year), "Første nyttårsdag" }, { MaundyThursday(easter), "Skjærtorsdag" }, { GoodFriday(easter), "Langfredag" }, { easter, "Første påskedag" }, { EasterMonday(easter), "Andre påskedag" }, { LabourDay(year), "Første mai" }, { ConstitutionDay(year), "Grunnlovsdagen" }, }; var ascension = Ascension(easter); if (!bHols.ContainsKey(ascension)) { //Ascension in 2012 is 17 May - same as Consitition Day bHols.Add(ascension, "Kristi himmelfartsdag"); } var whitSunday = WhitSunday(easter); if (!bHols.ContainsKey(whitSunday)) { bHols.Add(whitSunday, "Første pinsedag"); } bHols.Add(WhitMonday(easter), "Andre pinsedag"); bHols.Add(Christmas(year), "Første juledag"); bHols.Add(BoxingDay(year), "Andre juledag"); return(bHols); }
/// <summary> /// Public holiday names in Dutch. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string>(); bHols.Add(NewYear(year), "Nieuwjaar"); DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(EasterMonday(easter), "Paasmaandag"); DateTime mayday = MayDay(year); DateTime ascension = Ascension(easter); if (ascension == mayday) { ascension = ascension.AddSeconds(1); //ascension can fall on Mayday } bHols.Add(mayday, "Dag van de arbeid"); bHols.Add(ascension, "Hemelvaartsdag"); bHols.Add(PentecostMonday(easter), "Pinkstermaandag"); bHols.Add(National(year), "Nationale feestdag"); bHols.Add(Assumption(year), "Onze Lieve Vrouw hemelvaart"); bHols.Add(AllSaints(year), "Allerheiligen"); bHols.Add(Armistice(year), "Wapenstilstand"); bHols.Add(Christmas(year), "Kerstmis"); return(bHols); }
/// <summary> /// Maundy Thursday - Thursday before Easter /// </summary> /// <param name="year">The year.</param> /// <returns>Date of in the given year.</returns> public static DateTime MaundyThursday(int year) { var hol = HolidayCalculator.GetEaster(year); hol = hol.AddDays(-3); return(hol); }
/// <summary> /// Get a list of dates for all holidays in a year. /// </summary> /// <param name="year">The year</param> /// <returns>Dictionary of bank holidays</returns> public override IDictionary<DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary<DateTime, string>(); if (year > 1973) bHols.Add(NewYear(year), "New Year"); //New Year only in 1974 var easter = HolidayCalculator.GetEaster(year); bHols.Add(GoodFriday(easter), "Good Friday"); bHols.Add(EasterMonday(easter), "Easter Monday"); if (year == 2011) bHols.Add(new DateTime(2011, 4, 29), "Royal Wedding"); //Royal Wedding var dt = MayDay(year); if (dt.HasValue) bHols.Add(dt.Value, "Early May"); bHols.Add(Spring(year), "Spring"); if (year == 2002) bHols.Add(new DateTime(2002, 6, 3), "Golden Jubilee"); //Golden Jubilee of Elizabeth II if (year == 2012) bHols.Add(new DateTime(2012, 6, 5), "Queen's Diamond Jubilee"); //Queen's Diamond Jubilee if (year == 2022) bHols.Add(new DateTime(2022, 6, 3), "Queen's Platinum Jubilee"); //Queen's Platinum Jubilee bHols.Add(Summer(year), "Summer"); bHols.Add(Christmas(year), "Christmas"); bHols.Add(BoxingDay(year), "Boxing Day"); return bHols; }
/// <summary> /// Get a list of dates for all holidays in a year. /// </summary> /// <param name="year">The year</param> /// <returns>List of bank holidays</returns> public static IList<DateTime> BankHolidays(int year) { var bHols = new List<DateTime>(); if (year > 1973) bHols.Add(NewYear(year)); //New Year only in 1974 var easter = HolidayCalculator.GetEaster(year); bHols.Add(GoodFriday(easter)); bHols.Add(EasterMonday(easter)); var dt = MayDay(year); if (dt.HasValue) bHols.Add(dt.Value); bHols.Add(Spring(year)); if (year == 2002) bHols.Add(new DateTime(2002, 6, 3)); //Golden Jubilee of Elizabeth II if (year == 2011) bHols.Add(new DateTime(2012, 4, 29)); //Royal Wedding if (year == 2012) bHols.Add(new DateTime(2012, 6, 5)); //Queen's Diamond Jubilee if (year == 2022) bHols.Add(new DateTime(2022, 6, 3)); //Queen's Platinum Jubilee bHols.Add(Summer(year)); bHols.Add(Christmas(year)); bHols.Add(BoxingDay(year)); return bHols; }
/// <summary> /// Public holiday names in Swedish. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { DateTime easter = HolidayCalculator.GetEaster(year); var bHols = new Dictionary <DateTime, string> { { NewYear(year), "Nyårsdagen" }, { Epiphany(year), "Trettondag jul" }, { GoodFriday(easter), "Långfredag" }, { easter, "Påskdagen" }, { EasterMonday(easter), "Annandag påsk" }, { LabourDay(year), "Första maj" }, { Ascension(easter), "Kristi himmelfärds dag" }, { WhitSunday(easter), "Pingstdagen" }, { NationalDay(year), "Nationaldagen" }, { MidsummerEve(year), "Midsommarafton" }, { MidsummerDay(year), "Midsommardagen" }, { AllSaintsDay(year), "Alla helgons dag" }, { ChristmasEve(year), "Julafton" }, { Christmas(year), "Juldagen" }, { BoxingDay(year), "Annandag jul" }, { NewYearsEve(year), "Nyårsafton" } }; return(bHols); }
/// <summary> /// dzien Bozego Ciala - CorpusChristi /// </summary> /// <param name="year"></param> public static DateTime CorpusChristi(int year) { var hol = HolidayCalculator.GetEaster(year); //first Thursday after Trinity Sunday (Pentecost + 1 week) hol = hol.AddDays((7 * 8) + 4); return(hol); }
/// <summary> /// ECB - SEPA TARGET Closing Days names - in English /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string>(); bHols.Add(NewYear(year), "New Year’s Day"); DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(GoodFriday(easter), "Good Friday"); bHols.Add(EasterMonday(easter), "Easter Monday"); bHols.Add(LabourDay(year), "Labour Day"); bHols.Add(ChristmasDay(year), "Christmas Day"); bHols.Add(ChristmasHoliday(year), "Christmas Holiday"); return(bHols); }
/// <summary> /// Public holiday names in Lëtzebuergesch. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { //sorted dictionary as these may not be in order... var bHols = new SortedDictionary <DateTime, string> { { NewYear(year), "New Year" }, { AustraliaDay(year), "Australia Day" } }; var easter = HolidayCalculator.GetEaster(year); bHols.Add(GoodFriday(easter), "Good Friday"); bHols.Add(EasterMonday(easter), "Easter Monday"); if (State == States.ACT) { bHols.Add(CanberraDay(year), "Canberra Day"); } bHols.Add(AnzacDay(year, State), "ANZAC Day"); if (State == States.NT) { bHols.Add(PicnicDay(year), "Picnic Day"); } if (State == States.WA) { bHols.Add(WesternAustraliaDay(year), "Western Australia Day"); } if (State != States.All) { bHols.Add(LabourDay(year, State), "Labour Day"); bHols.Add(QueenBirthday(year, State), "Queen's Birthday"); } if (State == States.ACT) { var fac = FamilyAndCommunityDay(year); if (fac.HasValue) { bHols.Add(fac.Value, "Family And Community Day"); } } if (State == States.VIC) { bHols.Add(MelbourneCup(year), "Melbourne Cup"); } bHols.Add(Christmas(year), "Christmas Day"); bHols.Add(BoxingDay(year), State == States.SA ? "Proclamation Day" : "Boxing Day"); return(bHols); }
/// <summary> /// Public holiday names in Irish Gaelic. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string> { { NewYear(year), "Lá Caille" }, { StPatricksDay(year), "Lá Fhéile Pádraig" } }; DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(EasterMonday(easter), "Luan Cásca"); bHols.Add(MayDay(year), "Lá Bealtaine"); bHols.Add(JuneHoliday(year), "Lá Saoire i mí an Mheithimh"); bHols.Add(AugustHoliday(year), "Lá Saoire i mí Lúnasa"); bHols.Add(OctoberHoliday(year), "Lá Saoire i mí Dheireadh Fómhair"); bHols.Add(Christmas(year), "Lá Nollag"); bHols.Add(StStephen(year), "Lá Fhéile Stiofáin"); return(bHols); }
/// <summary> /// Public holiday names in Lëtzebuergesch. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string> { { NewYear(year), "Neijoerschdag" } }; DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(EasterMonday(easter), "Ouschterméindeg"); bHols.Add(LabourDay(year), "Dag vun der Aarbecht"); bHols.Add(Ascension(easter), "Christi Himmelfaar"); bHols.Add(PentecostMonday(easter), "Péngschtméindeg"); bHols.Add(NationalDay(year), "Nationalfeierdag"); bHols.Add(Assumption(year), "Mariä Himmelfaart"); bHols.Add(AllSaints(year), "Allerhellgen"); bHols.Add(Christmas(year), "Chrëschtdag"); bHols.Add(StStephen(year), "Stiefesdag"); return(bHols); }
/// <summary> /// Get a list of dates for all holidays in a year. /// </summary> /// <param name="year">The year</param> /// <returns>List of bank holidays</returns> public override IList <DateTime> PublicHolidays(int year) { var bHols = new List <DateTime>(); bHols.Add(NewYear(year)); var easter = HolidayCalculator.GetEaster(year); bHols.Add(GoodFriday(easter)); bHols.Add(EasterMonday(easter)); bHols.Add(VictoriaDay(year)); bHols.Add(CanadaDay(year)); bHols.Add(LabourDay(year)); bHols.Add(Thanksgiving(year)); bHols.Add(RemembranceDay(year)); bHols.Add(Christmas(year)); bHols.Add(BoxingDay(year)); return(bHols); }
/// <summary> /// Get a list of dates with names for all holidays in a year. /// </summary> /// <param name="year">The year.</param> /// <returns> /// Dictionary of bank holidays /// </returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string> { { NewYear(year), "New Year" }, { DayAfterNewYear(year), "Day After New Year" }, { WaitangiDay(year), "Waitangi Day" } }; var easter = HolidayCalculator.GetEaster(year); bHols.Add(GoodFriday(easter), "Good Friday"); bHols.Add(EasterMonday(easter), "Easter Monday"); bHols.Add(AnzacDay(year), "Anzac Day"); bHols.Add(QueenBirthday(year), "Queen's Birthday"); bHols.Add(LabourDay(year), "Labour Day"); bHols.Add(Christmas(year), "Christmas Day"); bHols.Add(BoxingDay(year), "Boxing Day"); return(bHols); }
/// <summary> /// Get a list of dates for all holidays in a year. /// </summary> /// <param name="year">The year</param> /// <returns>Dictionary of bank holidays</returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string>(); bHols.Add(NewYear(year), "New Year"); var easter = HolidayCalculator.GetEaster(year); bHols.Add(GoodFriday(easter), "Good Friday"); bHols.Add(EasterMonday(easter), "Easter Monday"); bHols.Add(VictoriaDay(year), "Victoria Day"); bHols.Add(CanadaDay(year), "Canada Day"); bHols.Add(LabourDay(year), "Labour Day"); bHols.Add(Thanksgiving(year), "Thanksgiving"); bHols.Add(RemembranceDay(year), "Remembrance Day"); bHols.Add(Christmas(year), "Christmas"); bHols.Add(BoxingDay(year), "Boxing Day"); return(bHols); }
/// <summary> /// Public holiday names in Italian. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string> { { NewYear(year), "Nowy Rok" }, { Epiphany(year), "Swieto Trzech Króli" } }; DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(EasterMonday(easter), "Poniedzialek Wielkanocny"); bHols.Add(LabourDay(year), "Swieto Panstwowe"); bHols.Add(ConstitutionDay(year), "Swieto Narodowe Trzeciego Maja"); bHols.Add(CorpusChristi(year), "dzien Bozego Ciala"); bHols.Add(Assumption(year), "Wniebowziecie Najswietszej Maryi Panny"); bHols.Add(AllSaints(year), "Wszystkich Swietych"); bHols.Add(IndependenceDay(year), "Narodowe Swieto Niepodleglosci"); bHols.Add(Christmas(year), "pierwszy dzien Bozego Narodzenia"); bHols.Add(StStephen(year), "drugi dzien Bozego Narodzenia"); return(bHols); }
/// <summary> /// Public holiday names in German. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { DateTime easter = HolidayCalculator.GetEaster(year); var bHols = new Dictionary <DateTime, string> { { NewYear(year), "Neujahrstag" }, { GoodFriday(easter), "Karfreitag" }, { easter, "Ostern" }, { EasterMonday(easter), "Ostermontag" }, { Ascension(easter), "Auffahrt" }, { WhitSunday(easter), "Pingsten" }, { WhitMonday(easter), "Pingstmontag" }, { NationalDay(year), "Bundesfeier" }, { Christmas(year), "Weihnachten" }, { BoxingDay(year), "Stephanstag" }, }; if (_hasSecondJanuary) { bHols.Add(SecondJanuary(year), "Berchtoldstag"); } if (_hasLaborDay) { bHols.Add(LabourDay(year), "Tag der Arbeit"); } if (_hasCorpusChristi) { bHols.Add(CorpusChristi(easter), "Fronleichnam"); } if (_hasChristmasEve) { bHols.Add(ChristmasEve(year), "Heiligabend"); } if (_hasNewYearsEve) { bHols.Add(NewYearsEve(year), "Silvester"); } return(bHols); }
/// <summary> /// Public holiday names in Dutch. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { var bHols = new Dictionary <DateTime, string>(); bHols.Add(NewYear(year), "Nieuwjaar"); DateTime easter = HolidayCalculator.GetEaster(year); bHols.Add(EasterMonday(easter), "Paasmaandag"); bHols.Add(KingsDay(year), "Koningsdag"); var liberationDay = LiberationDay(year); if (liberationDay != null) { bHols.Add(liberationDay.Value, "Bevrijdingsdag"); } bHols.Add(Ascension(easter), "Hemelvaartsdag"); bHols.Add(PentecostMonday(easter), "Pinkstermaandag"); bHols.Add(Christmas(year), "Eerste Kerstdag"); bHols.Add(BoxingDay(year), "Tweede Kerstdag"); return(bHols); }
/// <summary> /// Public holiday names in Lëtzebuergesch. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { //sorted dictionary as these may not be in order... var bHols = new SortedDictionary <DateTime, string> { { NewYear(year), "New Year" }, { HumanRightsDay(year), "Human Rights Day" } }; var easter = HolidayCalculator.GetEaster(year); bHols.Add(GoodFriday(easter), "Good Friday"); bHols.Add(EasterMonday(easter), "Family Day"); bHols.Add(FreedomDay(year), "Freedom Day"); bHols.Add(LabourDay(year), "Workers' Day"); bHols.Add(YouthDay(year), "Youth Day"); bHols.Add(NationalWomensDay(year), "National Women's Day"); bHols.Add(HeritageDay(year), "Heritage Day"); bHols.Add(ReconciliationDay(year), "Day of Reconciliation"); bHols.Add(Christmas(year), "Christmas Day"); bHols.Add(BoxingDay(year), "Day of Goodwill"); return(bHols); }
/// <summary> /// Public holiday names in Norwegian. /// </summary> /// <param name="year">The year.</param> /// <returns></returns> public override IDictionary <DateTime, string> PublicHolidayNames(int year) { DateTime easter = HolidayCalculator.GetEaster(year); var bHols = new Dictionary <DateTime, string> { { NewYear(year), "Første nyttårsdag" }, { MaundyThursday(easter), "Skjærtorsdag" }, { GoodFriday(easter), "Langfredag" }, { easter, "Første påskedag" }, { EasterMonday(easter), "Andre påskedag" }, { LabourDay(year), "Første mai" }, { ConstitutionDay(year), "Grunnlovsdagen" }, { Ascension(easter), "Kristi himmelfartsdag" }, { WhitSunday(easter), "Første pinsedag" }, { WhitMonday(easter), "Andre pinsedag" }, { Christmas(year), "Første juledag" }, { BoxingDay(year), "Andre juledag" } }; return(bHols); }
/// <summary> /// Easter /// </summary> /// <param name="year">The year.</param> /// <returns>Date of in the given year.</returns> public static DateTime Easter(int year) { return(HolidayCalculator.GetEaster(year)); }
/// <summary> /// Check if a specific date is a public holiday. /// Obviously the PublicHoliday list is more efficient for repeated checks /// </summary> /// <param name="dt">The date you wish to check</param> /// <returns>True if date is a public holiday</returns> public override bool IsPublicHoliday(DateTime dt) { var year = dt.Year; var date = dt.Date; switch (dt.Month) { case 1: if (NewYear(year) == date) { return(true); } break; case 3: case 4: if (MaundyThursday(year) == date) { return(true); } if (GoodFriday(year) == date) { return(true); } if (HolidayCalculator.GetEaster(year) == date) { return(true); } if (EasterMonday(year) == date) { return(true); } if (Ascension(year) == date) { return(true); } break; case 5: if (LabourDay(year) == date) { return(true); } if (ConstitutionDay(year) == date) { return(true); } if (Ascension(year) == date) { return(true); } if (WhitSunday(year) == date) { return(true); } if (WhitMonday(year) == date) { return(true); } break; case 6: if (Ascension(year) == date) { return(true); } if (WhitSunday(year) == date) { return(true); } if (WhitMonday(year) == date) { return(true); } break; case 12: if (Christmas(year) == date) { return(true); } if (BoxingDay(year) == date) { return(true); } break; } return(false); }