/// <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); }
/// <summary> /// Date of New Year bank holiday. This is 1974 on only but will return pre 1974 dates. /// </summary> /// <param name="year"></param> /// <returns></returns> public static DateTime NewYear(int year) { //since 1974 only DateTime hol = new DateTime(year, 1, 1); hol = HolidayCalculator.FixWeekend(hol); 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); }
/// <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> /// 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> /// 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> /// 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> /// ANZAC day, 25th April, adjusted if on weekends (specific states only) /// </summary> /// <param name="year">The year.</param> /// <param name="state">The state.</param> /// <returns></returns> public static DateTime AnzacDay(int year, States state) { if (state == States.ACT || state == States.NT || state == States.SA || state == States.WA) { return(HolidayCalculator.FixWeekend(new DateTime(year, 4, 25))); } return(new DateTime(year, 4, 25)); }
/// <summary> /// Canada day, 1 July or following Monday /// </summary> /// <param name="year"></param> /// <returns></returns> public static DateTime CanadaDay(int year) { var hol = new DateTime(year, 7, 1); //hol = HolidayCalculator.FindFirstMonday(hol); hol = HolidayCalculator.FixWeekend(hol); return(hol); }
/// <summary> /// Boxing Day /// </summary> /// <param name="year"></param> /// <returns></returns> public static DateTime BoxingDay(int year) { DateTime hol = new DateTime(year, 12, 26); //if Xmas=Sun, it's shifted to Mon and 26 also gets shifted bool isSundayOrMonday = hol.DayOfWeek == DayOfWeek.Sunday || hol.DayOfWeek == DayOfWeek.Monday; hol = HolidayCalculator.FixWeekend(hol); if (isSundayOrMonday) hol = hol.AddDays(1); return hol; }
/// <summary> /// Lá Fhéile Stiofáin - St Stephen's Day /// </summary> /// <param name="year"></param> /// <returns></returns> public static DateTime StStephen(int year) { var hol = new DateTime(year, 12, 26); bool isSundayOrMonday = hol.DayOfWeek == DayOfWeek.Sunday || hol.DayOfWeek == DayOfWeek.Monday; hol = HolidayCalculator.FixWeekend(hol); if (isSundayOrMonday) { hol = hol.AddDays(1); } return(hol); }
/// <summary> /// Day After New Year's Day /// </summary> /// <param name="year">The year.</param> /// <returns>Date of in the given year.</returns> public static DateTime DayAfterNewYear(int year) { var ny = NewYear(year); //may be shifted to Monday, so we have to add a day return(HolidayCalculator.FixWeekend(ny.AddDays(1))); }
/// <summary> /// New Year's Day /// </summary> /// <param name="year">The year.</param> /// <returns>Date of in the given year.</returns> public static DateTime NewYear(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 1, 1))); }
/// <summary> /// Boxing Day /// </summary> /// <param name="year"></param> /// <returns></returns> public static DateTime BoxingDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 12, 26))); }
/// <summary> /// Christmas /// </summary> /// <param name="year"></param> /// <returns></returns> public static DateTime Christmas(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 12, 25))); }
/// <summary> /// National Women's Day August 9 /// </summary> /// <param name="year"></param> public static DateTime NationalWomensDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 8, 9))); }
/// <summary> /// Heritage Day September 24 /// </summary> /// <param name="year"></param> public static DateTime HeritageDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 9, 24))); }
/// <summary> /// Lá Fhéile Pádraig - St Patrick's Day March 17 /// </summary> /// <param name="year"></param> public static DateTime StPatricksDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 3, 17))); }
/// <summary> /// Human Rights Day March 21 /// </summary> /// <param name="year"></param> public static DateTime HumanRightsDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 3, 21))); }
/// <summary> /// Freedom Day April 27 /// </summary> /// <param name="year"></param> public static DateTime FreedomDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 4, 27))); }
/// <summary> /// Soweto Day/Youth Day June 16 /// </summary> /// <param name="year"></param> public static DateTime YouthDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 6, 16))); }
/// <summary> /// ANZAC day, 25th April. /// Unless it falls on a weekend and then it becomes a Monday holiday. /// </summary> /// <param name="year"></param> public static DateTime AnzacDay(int year) { var anzac = new DateTime(year, 4, 25); return(year >= 2015 ? HolidayCalculator.FixWeekend(anzac) : anzac); }
/// <summary> /// Australia Day January 26 /// </summary> /// <param name="year"></param> public static DateTime AustraliaDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 1, 26))); }
/// <summary> /// Waitangi Day - 6th February /// </summary> /// <param name="year">The year.</param> /// <returns>Date of in the given year.</returns> public static DateTime WaitangiDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 2, 6))); }
/// <summary> /// Day of Reconciliation September 24 /// </summary> /// <param name="year"></param> public static DateTime ReconciliationDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 12, 16))); }
/// <summary> /// Boxing Day /// </summary> /// <remarks> /// If boxing day lands on a Sunday then the public holiday must be observed on the following Tuesday. /// So xmas and boxing days can be both Saturday and Sunday, followed by public holidays for both Monday and Tuesday. /// </remarks> /// <param name="year"></param> /// <returns></returns> public static DateTime BoxingDay(int year) { var xmas = Christmas(year); // May be shifted to Monday, so we have to add a day. return(HolidayCalculator.FixWeekend(xmas.AddDays(1))); }
/// <summary> /// Lá Bealtaine - May Day /// </summary> /// <param name="year">The year.</param> public static DateTime MayDay(int year) { return(HolidayCalculator.FixWeekend(new DateTime(year, 5, 1))); }