Converts a string to a DateTime if possible.
static DateTime? toDateTime(String input) { try { return DateTime.parse(input); } catch (_) { return null; } }