/// <summary> /// Returns the number of days of the specified <paramref name="month"/> of the <paramref name="fullYear"/>. /// </summary> /// <param name="fullYear">The full year, for example, 1976 (and not 76).</param> /// <param name="month">The month as a <see cref="CivilMonth"/> enum between January and December.</param> /// <returns>The number of days.</returns> public static int GetDaysInMonth(int fullYear, CivilMonth month) { int[] monthLengths = null; monthLengths = IsLeapYear(fullYear) ? LEAP_YEAR_MONTH_LENGTHS : COMMON_YEAR_MONTH_LENGTHS; return(monthLengths[(int)month]); }
/// <summary> /// Initializes a new instance of the <see cref="CivilDate"/> class to the specified year, month, and day. /// </summary> /// <param name="day">The date as an integer between 1 and 31.</param> /// <param name="month">The month as a <see cref="CivilMonth"/> enum between January and December.</param> /// <param name="fullYear">The full year, for example, 1976 (and not 76).</param> public CivilDate(int fullYear, CivilMonth month, int day) { int maxDay = 0; maxDay = CivilDate.GetDaysInMonth(fullYear, month); _day = (day > maxDay ? maxDay : day); _month = month; _fullYear = fullYear; }