From 9fc1cbd7aec9c6cf32a4e4716822c9fbe4915ab7 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 31 Oct 2023 12:24:48 +0000 Subject: [PATCH 1/3] Change cast to include format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://laravel.com/docs/8.x/eloquent-mutators#date-casting - this doesn’t seem to work tho? Signed-off-by: snipe --- app/Models/License.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Models/License.php b/app/Models/License.php index 44f1f45b70..ba00b7d0d4 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -32,10 +32,11 @@ class License extends Depreciable protected $guarded = 'id'; protected $table = 'licenses'; + protected $casts = [ - 'purchase_date' => 'date', - 'expiration_date' => 'date', - 'termination_date' => 'date', + 'purchase_date' => 'date:Y-m-d', + 'expiration_date' => 'date:Y-m-d', + 'termination_date' => 'date:Y-m-d', 'category_id' => 'integer', 'company_id' => 'integer', ]; From 209627e2cc828eea439fed92d422b84a7e6ef877 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 31 Oct 2023 12:25:00 +0000 Subject: [PATCH 2/3] Force format if dates are given Signed-off-by: snipe --- resources/views/licenses/edit.blade.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/licenses/edit.blade.php b/resources/views/licenses/edit.blade.php index cdbbc23e74..b0ff9063f2 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', '') !!} From 5779a632216b678ef86c6c5577fcf0cd44fd331c Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 31 Oct 2023 12:28:57 +0000 Subject: [PATCH 3/3] Undoing that thing I just did :( Signed-off-by: snipe --- app/Models/License.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Models/License.php b/app/Models/License.php index ba00b7d0d4..2ea10939fa 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -34,9 +34,9 @@ class License extends Depreciable protected $casts = [ - 'purchase_date' => 'date:Y-m-d', - 'expiration_date' => 'date:Y-m-d', - 'termination_date' => 'date:Y-m-d', + 'purchase_date' => 'date', + 'expiration_date' => 'date', + 'termination_date' => 'date', 'category_id' => 'integer', 'company_id' => 'integer', ];