isAfter function

bool isAfter (
  1. String str,
  2. [dynamic date]
)

check if the string is a date that's after the specified date

If date is not passed, it defaults to now.

Implementation

bool isAfter(String str, [date]) {
  if (date == null) {
    date = new DateTime.now();
  } else if (isDate(date)) {
    date = DateTime.parse(date);
  } else {
    return false;
  }

  DateTime str_date;
  try {
    str_date = DateTime.parse(str);
  } catch (e) {
    return false;
  }

  return str_date.isAfter(date);
}