F
FilamentMark Chaney

Custom ValidationMessages for minDate/maxDate

I have tried the following, but the html5 validation still shows the default browser error. Do i need to about it differently?
DatePicker::configureUsing(function (DatePicker $datePicker) {
return $datePicker->minDate(Carbon::createFromDate(1500, 1, 1))
->maxDate(now()->addYears(9))
->validationMessages([
'after_or_equal' => 'The :attribute must be after January 1, 1500.',
'before_or_equal' => 'The :attribute cannot be more than 9 years in the future.',
]);
});
DatePicker::configureUsing(function (DatePicker $datePicker) {
return $datePicker->minDate(Carbon::createFromDate(1500, 1, 1))
->maxDate(now()->addYears(9))
->validationMessages([
'after_or_equal' => 'The :attribute must be after January 1, 1500.',
'before_or_equal' => 'The :attribute cannot be more than 9 years in the future.',
]);
});
Mark Chaney
Mark Chaney15d ago
actually i think this is now working. hmm, i need to double check. i Know my macro version is at least working for a different requirement set. Need to double check this global one
Mark Chaney
Mark Chaney15d ago
Hmm, sometimes the below the field validation shows and other times its the html5 version with
No description