/// <summary> /// Constructs an instance for the given year, month and day in the specified calendar. /// </summary> /// <param name="year">The year. This is the "absolute year", so, for /// the ISO calendar, a value of 0 means 1 BC, for example.</param> /// <param name="month">The month of year.</param> /// <param name="day">The day of month.</param> /// <param name="calendar">Calendar system in which to create the date.</param> /// <returns>The resulting date.</returns> /// <exception cref="ArgumentOutOfRangeException">The parameters do not form a valid date.</exception> public LocalDate(int year, int month, int day, [NotNull] CalendarSystem calendar) { Preconditions.CheckNotNull(calendar, nameof(calendar)); calendar.ValidateYearMonthDay(year, month, day); yearMonthDayCalendar = new YearMonthDayCalendar(year, month, day, calendar.Ordinal); }
/// <summary> /// Constructs an instance for the given year, month and day in the specified calendar. /// </summary> /// <param name="year">The year. This is the "absolute year", so, for /// the ISO calendar, a value of 0 means 1 BC, for example.</param> /// <param name="month">The month of year.</param> /// <param name="calendar">Calendar system in which to create the year/month.</param> /// <returns>The resulting year/month.</returns> /// <exception cref="ArgumentOutOfRangeException">The parameters do not form a valid year/month.</exception> public YearMonth(int year, int month, CalendarSystem calendar) { Preconditions.CheckNotNull(calendar, nameof(calendar)); calendar.ValidateYearMonthDay(year, month, 1); startOfMonth = new YearMonthDayCalendar(year, month, 1, calendar.Ordinal); }