isDateTime static method
bool
isDateTime(
- dynamic v, {
- String format = defDateTimeFormat,
- String? locale,
- bool isUtc = false,
})
Implementation
static bool isDateTime(v,
{String format = defDateTimeFormat, String? locale, bool isUtc = false}) {
if (v == null) return true;
if (v is num) return true;
if (v is DateTime) return true;
if (v is String) {
final num? n = num.tryParse(v);
if (n != null) return true;
final df = DateFormat(format, locale);
try {
df.parse(v, isUtc);
return true;
} catch (e) {
return false;
}
}
return false;
}