isDate function

bool isDate (
  1. String str
)

check if the string is a date

Implementation

bool isDate(String str) {
  try {
    DateTime.parse(str);
    return true;
  } catch (e) {
    return false;
  }
}