inYear method
Returns this annual date in a particular year, as a LocalDate.
If this value represents February 29th, and the specified year is not a leap
year, the returned value will be February 28th of that year. To see whether the
original month and day is valid without truncation in a particular year,
use IsValidYear
year
: The year component of the required date.
Returns: A date in the given year, suitable for this annual date.
Implementation
LocalDate inYear(int year) {
Preconditions.checkArgumentRange('year', year,
GregorianYearMonthDayCalculator.minGregorianYear,
GregorianYearMonthDayCalculator.maxGregorianYear);
var ymd = ICalendarSystem.yearMonthDayCalculator(CalendarSystem.iso).setYear(_value, year);
return ILocalDate.trusted(ymd.withCalendarOrdinal(const CalendarOrdinal(0))); // ISO calendar
}