hasMonthPassed static method

bool hasMonthPassed(
  1. int? year,
  2. int? month,
  3. DateTime? now
)

Determines whether the input year-month pair has passed.

@param year the input year, as a two or four-digit integer @param month the input month @param now the current time @return {@code true} if the input time has passed the specified current time, {@code false} otherwise.

Implementation

static bool hasMonthPassed(int ?year, int? month, DateTime? now) {
  if(year ==null || month == null || now==null) {
    return false;
  }
  if (hasYearPassed(year, now)) {
    return true;
  }

  // Expires at end of specified month, Calendar month starts at 0
  return normalizeYear(year, now) == now.year && month < (now.month + 1);
}