tryToDateTime method

DateTime? tryToDateTime()

Attempts to parse this string into a DateTime, returning null on failure.

Implementation

DateTime? tryToDateTime() {
  try {
    return toDateTime();
  } catch (_) {
    return null;
  }
}