From 869febc1d32bd4fa70d71e5192f2b5a73d0431d5 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 18 Feb 2016 12:02:30 +0200 Subject: [PATCH] Fix for Date in Expenses #731 --- app/Http/Controllers/ExpenseController.php | 2 +- app/Models/Expense.php | 2 +- resources/views/expenses/edit.blade.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/ExpenseController.php b/app/Http/Controllers/ExpenseController.php index 6f2a6e884a..5535b863e8 100644 --- a/app/Http/Controllers/ExpenseController.php +++ b/app/Http/Controllers/ExpenseController.php @@ -96,7 +96,7 @@ class ExpenseController extends BaseController { $expense = Expense::scope($publicId)->firstOrFail(); $expense->expense_date = Utils::fromSqlDate($expense->expense_date); - + $actions = []; if ($expense->invoice) { $actions[] = ['url' => URL::to("invoices/{$expense->invoice->public_id}/edit"), 'label' => trans("texts.view_invoice")]; diff --git a/app/Models/Expense.php b/app/Models/Expense.php index 2749607c87..2d1b8041d7 100644 --- a/app/Models/Expense.php +++ b/app/Models/Expense.php @@ -12,7 +12,7 @@ class Expense extends EntityModel use SoftDeletes; use PresentableTrait; - protected $dates = ['deleted_at','expense_date']; + protected $dates = ['deleted_at']; protected $presenter = 'App\Ninja\Presenters\ExpensePresenter'; protected $fillable = [ diff --git a/resources/views/expenses/edit.blade.php b/resources/views/expenses/edit.blade.php index c2e00ab6af..589c8d8cda 100644 --- a/resources/views/expenses/edit.blade.php +++ b/resources/views/expenses/edit.blade.php @@ -160,7 +160,7 @@ } $vendorSelect.combobox(); - $('#expense_date').datepicker('update', new Date()); + $('#expense_date').datepicker('update', '{{ $expense ? $expense->expense_date : 'new Date()' }}'); $('.expense_date .input-group-addon').click(function() { toggleDatePicker('expense_date');