parse static method
Creates a new LocalDate from a formattedString
.
Expects a string in the format YYYY-MM-DD
, without any timezone.
Throws a FormatException is the string cannot be parsed.
Implementation
static LocalDate parse(String formattedString) {
if (!_localDateRegex.hasMatch(formattedString)) {
throw FormatException("invalid LocalDate format", formattedString);
}
return LocalDate.fromDateTime(DateTime.parse(formattedString));
}