/// <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 #2
0
        /// <summary>
        /// Queen's Birthday (varies by state)
        /// </summary>
        /// <param name="year">The year.</param>
        /// <param name="state">The state.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentException">You must specify one of the states/territories - state</exception>

        public static DateTime QueenBirthday(int year, States state)
        {
            switch (state)
            {
            case States.All:
                throw new ArgumentException("You must specify one of the states/territories", nameof(state));

            case States.ACT:
            case States.NSW:
            case States.NT:
            case States.SA:
            case States.TAS:
            case States.VIC:
                //second Monday in June
                return(HolidayCalculator.FindNext(new DateTime(year, 6, 1), DayOfWeek.Monday).AddDays(7));

            case States.QLD:
                //first Monday in October
                if (year >= 2016 || year == 2012)
                {
                    return(HolidayCalculator.FindNext(new DateTime(year, 10, 1), DayOfWeek.Monday));
                }
                //before 2016 was in June
                return(HolidayCalculator.FindNext(new DateTime(year, 6, 1), DayOfWeek.Monday).AddDays(7));

            case States.WA:
                //last Monday of September or first of October. No firm rule, all recent dates are September
                return(HolidayCalculator.FindPrevious(new DateTime(year, 9, 30), DayOfWeek.Monday));

            default:
                throw new ArgumentOutOfRangeException(nameof(state), state, "Invalid state");
            }
        }
Exemple #3
0
 /// <summary>
 /// The Spring/Last Monday in May holiday (replaced variable Whit Monday in 1971)
 /// </summary>
 /// <param name="year"></param>
 /// <returns></returns>
 public static DateTime Spring(int year)
 {
     if (year == 2002) return new DateTime(2002, 6, 4); //Golden Jubilee of Elizabeth II
     if (year == 2012) return new DateTime(2012, 6, 4); //Queen's Diamond Jubilee
     if (year == 2022) return new DateTime(2022, 6, 2); //Queen's Platinum Jubilee
     DateTime hol = new DateTime(year, 5, 31);
     hol = HolidayCalculator.FindPrevious(hol, DayOfWeek.Monday);
     return hol;
 }
        /// <summary>
        /// The Spring/Last Monday in May holiday (replaced variable Whit Monday in 1971)
        /// </summary>
        /// <param name="year"></param>
        /// <returns></returns>
        public static DateTime Spring(int year)
        {
            if (year == 2002)
            {
                return(new DateTime(2002, 6, 4));              //Golden Jubilee of Elizabeth II
            }
            if (year == 2012)
            {
                return(new DateTime(2012, 6, 4));              //Queen's Diamond Jubilee
            }
            DateTime hol = new DateTime(year, 5, 31);

            hol = HolidayCalculator.FindPrevious(hol, DayOfWeek.Monday);
            return(hol);
        }
        /// <summary>
        /// Lá Saoire i mí Dheireadh Fómhair - October Holiday
        /// </summary>
        /// <param name="year"></param>

        public static DateTime OctoberHoliday(int year)
        {
            return(HolidayCalculator.FindPrevious(new DateTime(year, 10, 31), DayOfWeek.Monday));
        }