toDate function

DateTime toDate (
  1. String str
)

convert the input to a date, or null if the input is not a date

Implementation

DateTime toDate(String str) {
  try {
    return DateTime.parse(str);
  } catch (e) {
    return null;
  }
}