parseDate function
Parses a date from the given value and returns it as a DateTime.
- Throws a FormatException if the
valueis empty or contains an invalid date.
Implementation
DateTime parseDate(String value) {
if (value.isEmpty) {
throw const FormatException('Value cannot be empty');
}
try {
return parseHttpDate(value);
} catch (e) {
throw const FormatException('Invalid date format');
}
}