isPastMonthYear static method

bool isPastMonthYear(
  1. String input
)

Implementation

static bool isPastMonthYear(String input) {
  try {
    final inputDate = DateFormat('MM-yyyy').parseStrict(input);
    final now = DateTime(DateTime.now().year, DateTime.now().month);
    return inputDate.isBefore(now) || inputDate.isAtSameMomentAs(now);
  } catch (_) {
    return false;
  }
}