isValidYear method

bool isValidYear(
  1. int year
)

Checks whether the specified year forms a valid date with the month/day in this value, without any truncation. This will always return true except for values representing February 29th, where the specified year is a non leap year.

  • year: The year to test for validity

Returns: true if the current value occurs within the given year; false otherwise.

Implementation

bool isValidYear(int year) {
  return month != 2 || day != 29 || CalendarSystem.iso.isLeapYear(year);
}