/// <summary> /// Return the date for Easter Sunday on the given year for the calendar. /// </summary> /// <param name="year">Calendar year</param> /// <param name="calendar">Orthodox or Western calendar</param> /// <returns>DateTime</returns> public static DateTime GetEasterSunday(int year, EasterCalendar calendar = EasterCalendar.Western) { switch (calendar) { case EasterCalendar.Orthodox: return(GetOrthodoxEaster(year)); case EasterCalendar.Western: return(GetWesternEaster(year)); default: throw new NotImplementedException(); } }
/// <summary> /// Returns the date range for all Easter Sundays between the start /// and end years for the calendar. /// </summary> /// <param name="startYear"></param> /// <param name="endYear"></param> /// <param name="calendar"></param> /// <returns></returns> public static IEnumerable <DateTime> GetEasterSundays(int startYear, int endYear, EasterCalendar calendar = EasterCalendar.Western) { if (startYear > endYear) { throw new ArgumentException("endYear must be later than startYear."); } var list = new List <DateTime>(); for (var i = startYear; i <= endYear; i++) { var aDate = GetEasterSunday(i, calendar); list.Add(aDate); } return(list); }