diff --git a/src/Fieldtypes/Date.php b/src/Fieldtypes/Date.php index 481873d0d4..7af05db445 100644 --- a/src/Fieldtypes/Date.php +++ b/src/Fieldtypes/Date.php @@ -5,6 +5,7 @@ use Carbon\Exceptions\InvalidFormatException; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Validator; +use Illuminate\Validation\ValidationException; use InvalidArgumentException; use Statamic\Facades\GraphQL; use Statamic\Fields\Fieldtype; @@ -371,10 +372,16 @@ public function secondsEnabled() public function preProcessValidatable($value) { - Validator::make( - [$this->field->handle() => $value], - [$this->field->handle() => [new ValidationRule($this)]], - )->validate(); + try { + Validator::make( + ['field' => $value], + ['field' => [new ValidationRule($this)]], + [], + ['field' => $this->field->display()], + )->validate(); + } catch (ValidationException $e) { + throw ValidationException::withMessages([$this->field->fieldPathPrefix() => $e->errors()['field']]); + } if ($value === null) { return null;