/** * Checks whether or not the {@link #expYear} field is valid. * * @return {@code true} if valid, {@code false} otherwise. */ boolean validateExpYear(Calendar now) { return expYear != null && !ModelUtils.hasYearPassed(expYear, 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. */ @SuppressWarnings("WrongConstant") static boolean hasMonthPassed(int year, int month, Calendar now) { if (hasYearPassed(year, now)) { return true; } // Expires at end of specified month, Calendar month starts at 0 return normalizeYear(year, now) == now.get(Calendar.YEAR) && month < (now.get(Calendar.MONTH) + 1); }