diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e1145cd5c4..3b1ffb9b31 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -30,6 +30,7 @@ class Handler extends ExceptionHandler \League\OAuth2\Server\Exception\OAuthServerException::class, JsonException::class, SCIMException::class, //these generally don't need to be reported + InvalidFormatException::class, ]; /** @@ -79,7 +80,7 @@ class Handler extends ExceptionHandler // Handle standard requests that fail because Carbon cannot parse the date on validation (when a submitted date value is definitely not a date) if ($e instanceof InvalidFormatException) { - return redirect()->back()->with('error', trans('validation.date', ['attribute' => 'date'])); + return redirect()->back()->withInput()->with('error', trans('validation.date', ['attribute' => 'date'])); } // Handle API requests that fail diff --git a/app/Models/License.php b/app/Models/License.php index 41a3d7a52a..ff69d5f66d 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -49,9 +49,9 @@ class License extends Depreciable 'category_id' => 'required|exists:categories,id', 'company_id' => 'integer|nullable', 'purchase_cost'=> 'numeric|nullable|gte:0', - 'purchase_date' => 'date_format:Y-m-d|nullable', - 'expiration_date' => 'date_format:Y-m-d|nullable', - 'termination_date' => 'date_format:Y-m-d|nullable', + 'purchase_date' => 'date_format:Y-m-d|nullable|max:10', + 'expiration_date' => 'date_format:Y-m-d|nullable|max:10', + 'termination_date' => 'date_format:Y-m-d|nullable|max:10', ]; /** diff --git a/resources/views/licenses/edit.blade.php b/resources/views/licenses/edit.blade.php index f45e69ce96..cdbbc23e74 100755 --- a/resources/views/licenses/edit.blade.php +++ b/resources/views/licenses/edit.blade.php @@ -79,7 +79,7 @@
- +
{!! $errors->first('expiration_date', '') !!} @@ -93,7 +93,7 @@
- +
{!! $errors->first('termination_date', '') !!} diff --git a/resources/views/partials/forms/edit/datepicker.blade.php b/resources/views/partials/forms/edit/datepicker.blade.php index 3e5f1d478d..9d2a714bb7 100644 --- a/resources/views/partials/forms/edit/datepicker.blade.php +++ b/resources/views/partials/forms/edit/datepicker.blade.php @@ -3,7 +3,7 @@ {{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }}
- +
{!! $errors->first($fieldname, '') !!}