Exemple #1
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 #2
0
        /// <summary>
        /// Labour Day
        /// </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>
        /// <exception cref="System.ArgumentOutOfRangeException">state - No such state</exception>
        public static DateTime LabourDay(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.SA:
                //Australian Capital Territory, New South Wales and South Australia = first Monday in October
                return(HolidayCalculator.FindNext(new DateTime(year, 10, 1), DayOfWeek.Monday));

            case States.NT:
            case States.QLD:
                //Northern Territory and Queensland = May Day
                return(HolidayCalculator.FindNext(new DateTime(year, 5, 1), DayOfWeek.Monday));

            case States.TAS:
            case States.VIC:
                //Victoria and Tasmania = second Monday in March ("Eight Hours Day").
                return(HolidayCalculator.FindNext(new DateTime(year, 3, 1), DayOfWeek.Monday).AddDays(7));

            case States.WA:
                //Western Australia= first Monday in March
                return(HolidayCalculator.FindNext(new DateTime(year, 3, 1), DayOfWeek.Monday));

            default:
                throw new ArgumentOutOfRangeException(nameof(state), state, "No such state");
            }
        }
Exemple #3
0
        /// <summary>
        /// Family  and community day, Australian Capital Territory.
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns></returns>
        public static DateTime?FamilyAndCommunityDay(int year)
        {
            //first declared in 2007
            if (year < 2007)
            {
                return(null);
            }
            if (year >= 2007 && year <= 2009)
            {
                return(HolidayCalculator.FindNext(new DateTime(year, 11, 1), DayOfWeek.Tuesday));
            }
            //2010+ first Monday of the September/October school holidays
            //if coincides with Labour day, moves to 2nd Monday
            var facDay = HolidayCalculator.FindNext(new DateTime(year, 9, 25), DayOfWeek.Monday);

            if (facDay == HolidayCalculator.FindNext(new DateTime(year, 10, 1), DayOfWeek.Monday))
            {
                facDay = facDay.AddDays(7);
            }
            return(facDay);
        }
Exemple #4
0
        /// <summary>
        /// Queen's Birthday - first Monday in June
        /// </summary>
        /// <param name="year">The year.</param>

        public static DateTime QueenBirthday(int year)
        {
            return(HolidayCalculator.FindNext(new DateTime(year, 6, 1), DayOfWeek.Monday));
        }
Exemple #5
0
        /// <summary>
        /// Labour Day - 4th Monday in October
        /// </summary>
        /// <param name="year">The year.</param>

        public static DateTime LabourDay(int year)
        {
            return(HolidayCalculator.FindNext(new DateTime(year, 10, 1), DayOfWeek.Monday).AddDays(7 * 3));
        }
Exemple #6
0
 /// <summary>
 /// Melbourne Cup (most of Victoria)- first Tuesday of November
 /// </summary>
 /// <param name="year"></param>
 /// <returns></returns>
 public static DateTime MelbourneCup(int year)
 {
     return(HolidayCalculator.FindNext(new DateTime(year, 11, 1), DayOfWeek.Tuesday));
 }
Exemple #7
0
        /// <summary>
        /// Picnic Day (Northern Territory only), first Monday of August
        /// </summary>
        /// <param name="year"></param>

        public static DateTime PicnicDay(int year)
        {
            //only Northern Territory
            return(HolidayCalculator.FindNext(new DateTime(year, 8, 1), DayOfWeek.Monday));
        }
Exemple #8
0
 /// <summary>
 /// Western Australia Day, 1st Monday of June
 /// </summary>
 /// <param name="year">The year.</param>
 /// <returns></returns>
 public static DateTime WesternAustraliaDay(int year)
 {
     return(HolidayCalculator.FindNext(new DateTime(year, 6, 1), DayOfWeek.Monday));
 }
Exemple #9
0
        /// <summary>
        /// Canberra Day, 2nd Monday of March
        /// </summary>
        /// <param name="year">The year.</param>
        /// <returns></returns>
        public static DateTime CanberraDay(int year)
        {
            var secondMonday = HolidayCalculator.FindNext(new DateTime(year, 3, 1), DayOfWeek.Monday).AddDays(7);

            return(year < 2008 ? secondMonday.AddDays(7) : secondMonday);
        }