/// <summary>
        /// Aboriginal day (June 21)
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime AboriginalDay(int year)
        {
            var hol = new DateTime(year, 6, 21);

            hol = HolidayCalculator.FixWeekend(hol);
            return(hol);
        }
        /// <summary>
        /// Third Monday in January
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns></returns>
        public static Holiday MartinLutherKing(int year)
        {
            var hol = new DateTime(year, 1, 15);

            hol = HolidayCalculator.FindFirstMonday(hol);
            return(new Holiday(hol, hol));
        }
        /// <summary>
        /// Last Monday in May
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns></returns>
        public static Holiday MemorialDay(int year)
        {
            var hol = new DateTime(year, 5, 25);

            hol = HolidayCalculator.FindFirstMonday(hol);
            return(new Holiday(hol, hol));
        }
Exemple #4
0
        /// <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>
        /// Second Monday in October
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns></returns>
        public static Holiday ColumbusDay(int year)
        {
            var hol = new DateTime(year, 10, 8);

            hol = HolidayCalculator.FindFirstMonday(hol);
            return(new Holiday(hol, hol));
        }
        /// <summary>
        /// Summer bank holiday (last Monday in August)
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime Summer(int year)
        {
            DateTime hol = new DateTime(year, 8, 25);

            hol = HolidayCalculator.FindFirstMonday(hol);
            return(hol);
        }
        /// <summary>
        /// Christmas day
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime Christmas(int year)
        {
            DateTime hol = new DateTime(year, 12, 25);

            hol = HolidayCalculator.FixWeekend(hol);
            return(hol);
        }
        /// <summary>
        /// Discovery day (Third monday in August)
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime DiscoveryDay(int year)
        {
            var hol = new DateTime(year, 8, 1);

            hol = HolidayCalculator.FindOccurrenceOfDayOfWeek(hol, DayOfWeek.Monday, 3);
            return(hol);
        }
        /// <summary>
        /// Second Monday in October
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime Thanksgiving(int year)
        {
            var hol = new DateTime(year, 10, 8);

            hol = HolidayCalculator.FindFirstMonday(hol);
            return(hol);
        }
        /// <summary>
        /// First Monday in August. Only available in certain provinces, under different names- Saskatchewan day,  Regatta Day
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime CivicHoliday(int year)
        {
            var hol = new DateTime(year, 8, 1);

            hol = HolidayCalculator.FindFirstMonday(hol);
            return(hol);
        }
        /// <summary>
        /// Gold Cup Parade day (Third friday in August)
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime GoldCupParadeDay(int year)
        {
            var hol = new DateTime(year, 8, 1);

            hol = HolidayCalculator.FindOccurrenceOfDayOfWeek(hol, DayOfWeek.Friday, 3);
            return(hol);
        }
        /// <summary>
        /// Date of New Year bank holiday.
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime NewYear(int year)
        {
            var hol = new DateTime(year, 1, 1);

            hol = HolidayCalculator.FixWeekend(hol);
            return(hol);
        }
        /// <summary>
        /// Orangemen's day (July 12)
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime OrangemensDay(int year)
        {
            var hol = new DateTime(year, 7, 12);

            hol = HolidayCalculator.FindNearestDayOfWeek(hol, DayOfWeek.Monday);
            return(hol);
        }
        /// <summary>
        /// National holiday (June 24)
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime NationalHoliday(int year)
        {
            var hol = new DateTime(year, 6, 24);

            hol = HolidayCalculator.FixWeekend(hol);
            return(hol);
        }
Exemple #15
0
        /// <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>
        /// November 11
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime RemembranceDay(int year)
        {
            var hol = new DateTime(year, 11, 11);

            hol = HolidayCalculator.FixWeekend(hol);
            return(hol);
        }
        /// <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>
        /// St. Patricks day (March 17)
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime StPatricksDay(int year)
        {
            var hol = new DateTime(year, 3, 17);

            hol = HolidayCalculator.FindNearestDayOfWeek(hol, DayOfWeek.Monday);
            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>
        /// Buß- und Bettag - Repentance and Prayer
        /// </summary>
        /// <param name="year"></param>
        public static DateTime Repentance(int year)
        {
            var firstAdvent = HolidayCalculator.FindPrevious(Christmas(year), DayOfWeek.Sunday).AddDays(-28);
            var wednesday   = HolidayCalculator.FindPrevious(firstAdvent, DayOfWeek.Wednesday);

            return(wednesday);
        }
Exemple #21
0
        /// <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>
        /// 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);
        }
Exemple #23
0
        /// <summary>
        /// Easter Monday 1st Monday after Easter
        /// </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>
        /// 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);
        }
        /// <summary>
        /// Thanksgiving - Fourth Thursday in November
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns></returns>
        public static Holiday Thanksgiving(int year)
        {
            var hol = new DateTime(year, 11, 22);

            hol = HolidayCalculator.FindOccurrenceOfDayOfWeek(hol, DayOfWeek.Thursday, 1);
            return(new Holiday(hol, hol));
        }
Exemple #26
0
        /// <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>
        /// Washington's Birthday aka Presidents Day. Third Monday in February
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns></returns>
        public static Holiday PresidentsDay(int year)
        {
            var hol = new DateTime(year, 2, 15);

            hol = HolidayCalculator.FindFirstMonday(hol);
            return(new Holiday(hol, hol));
        }
        /// <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");
            }
            bHols.Add(WhitSunday(easter), "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>
        /// First Monday in September
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns></returns>
        public static Holiday LaborDay(int year)
        {
            var hol = new DateTime(year, 9, 1);

            hol = HolidayCalculator.FindFirstMonday(hol);
            return(new Holiday(hol, hol));
        }
        /// <summary>
        /// Saint George's day (April 23)
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime StGeorgesDay(int year)
        {
            var hol = new DateTime(year, 4, 23);

            hol = HolidayCalculator.FixWeekend(hol);
            return(hol);
        }