validateDateStringPtBr static method
Implementation
static String? validateDateStringPtBr(String? value, String fieldName) {
if (value == null || value.isEmpty || value.length < 1) {
return makeValidateFieldMessage(fieldName);
}
var dateArray = value.split('/');
var day = dateArray[0];
var mes = dateArray[1];
if (int.parse(day) < 1 || int.parse(day) > 31) {
return makeValidateInvalidFieldMessage(fieldName + ' - Dia');
}
if (int.parse(mes) < 1 || int.parse(mes) > 12) {
return makeValidateInvalidFieldMessage(fieldName + ' - Mês');
}
return null;
}