check if the string is a date
bool isDate(String str) { try { DateTime.parse(str); return true; } on FormatException { return false; } }