strToTime function
Implementation
DateTime strToTime(String s) {
final parts = s.split(":");
if (parts.length >= 2) {
final h = int.tryParse(parts[0]);
final m = int.tryParse(parts[1]);
final sec = parts.length > 2 ? int.tryParse(parts[2]) ?? 0 : 0;
if (h != null && m != null) {
return DateTime(1899, 12, 30, h, m, sec);
}
}
throw EDatabaseError('"$s" is not a valid time');
}