Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix date issue.
James Cole246fa0d6e45a
diff --git a/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php b/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.phpindex fa97eaaa82..be5ed5b0d8 100644--- a/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php+++ b/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php@@ -54,7 +54,7 @@ class AutocompleteRequest extends FormRequestreturn ['types' => $array,'query' => $this->string('query'),- 'date' => $this->date('date'),+ 'date' => $this->getCarbonDate('date'),'limit' => $limit,];}diff --git a/app/Api/V1/Requests/Data/DateRequest.php b/app/Api/V1/Requests/Data/DateRequest.phpindex 18feea7b45..ead7ffc4e2 100644--- a/app/Api/V1/Requests/Data/DateRequest.php+++ b/app/Api/V1/Requests/Data/DateRequest.php@@ -45,8 +45,8 @@ class DateRequest extends FormRequestpublic function getAll(): array{return [- 'start' => $this->date('start'),- 'end' => $this->date('end'),+ 'start' => $this->getCarbonDate('start'),+ 'end' => $this->getCarbonDate('end'),];}diff --git a/app/Api/V1/Requests/Data/Export/ExportRequest.php b/app/Api/V1/Requests/Data/Export/ExportRequest.phpindex c46f6fa60e..78dccc2a0a 100644--- a/app/Api/V1/Requests/Data/Export/ExportRequest.php+++ b/app/Api/V1/Requests/Data/Export/ExportRequest.php@@ -41,8 +41,8 @@ class ExportRequest extends FormRequestpublic function getAll(): array{$result = [- 'start' => $this->date('start') ?? Carbon::now()->subYear(),- 'end' => $this->date('end') ?? Carbon::now(),+ 'start' => $this->getCarbonDate('start') ?? Carbon::now()->subYear(),+ 'end' => $this->getCarbonDate('end') ?? Carbon::now(),'type' => $this->string('type'),];$parts = explode(',', $this->string('accounts'));diff --git a/app/Api/V1/Requests/Insight/GenericRequest.php b/app/Api/V1/Requests/Insight/GenericRequest.phpindex 8583d837b3..27aed9dc1a 100644--- a/app/Api/V1/Requests/Insight/GenericRequest.php+++ b/app/Api/V1/Requests/Insight/GenericRequest.php@@ -58,8 +58,8 @@ class GenericRequest extends FormRequestpublic function getAll(): array{return [- 'start' => $this->date('start'),- 'end' => $this->date('end'),+ 'start' => $this->getCarbonDate('start'),+ 'end' => $this->getCarbonDate('end'),];}@@ -204,7 +204,7 @@ class GenericRequest extends FormRequest*/public function getEnd(): Carbon{- $date = $this->date('end');+ $date = $this->getCarbonDate('end');$date->endOfDay();return $date;@@ -251,7 +251,7 @@ class GenericRequest extends FormRequest*/public function getStart(): Carbon{- $date = $this->date('start');+ $date = $this->getCarbonDate('start');$date->startOfDay();return $date;diff --git a/app/Api/V1/Requests/Models/Account/StoreRequest.php b/app/Api/V1/Requests/Models/Account/StoreRequest.phpindex e16b016a6f..c3fc17015f 100644--- a/app/Api/V1/Requests/Models/Account/StoreRequest.php+++ b/app/Api/V1/Requests/Models/Account/StoreRequest.php@@ -70,7 +70,7 @@ class StoreRequest extends FormRequest'account_number' => $this->string('account_number'),'account_role' => $this->string('account_role'),'opening_balance' => $this->string('opening_balance'),- 'opening_balance_date' => $this->date('opening_balance_date'),+ 'opening_balance_date' => $this->getCarbonDate('opening_balance_date'),'cc_type' => $this->string('credit_card_type'),'cc_monthly_payment_date' => $this->string('monthly_payment_date'),'notes' => $this->stringWithNewlines('notes'),@@ -82,7 +82,7 @@ class StoreRequest extends FormRequestif ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) {$data['opening_balance'] = app('steam')->negative($this->string('liability_amount'));- $data['opening_balance_date'] = $this->date('liability_start_date');+ $data['opening_balance_date'] = $this->getCarbonDate('liability_start_date');$data['account_type_name'] = $this->string('liability_type');$data['liability_direction'] = $this->string('liability_direction');$data['account_type_id'] = null;diff --git a/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php b/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.phpindex e97d870d66..e2e777430c 100644--- a/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php+++ b/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php@@ -44,8 +44,8 @@ class StoreRequest extends FormRequestpublic function getAll(): array{return [- 'start' => $this->date('start'),- 'end' => $this->date('end'),+ 'start' => $this->getCarbonDate('start'),+ 'end' => $this->getCarbonDate('end'),'amount' => $this->string('amount'),'currency_id' => $this->integer('currency_id'),'currency_code' => $this->string('currency_code'),diff --git a/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php b/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.phpindex 082f482412..6c06445067 100644--- a/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php+++ b/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php@@ -51,8 +51,8 @@ class StoreRequest extends FormRequest$data['account_id'] = $this->integer('account_id');$data['targetamount'] = $this->string('target_amount');$data['current_amount'] = $this->string('current_amount');- $data['startdate'] = $this->date('start_date');- $data['targetdate'] = $this->date('target_date');+ $data['startdate'] = $this->getCarbonDate('start_date');+ $data['targetdate'] = $this->getCarbonDate('target_date');$data['notes'] = $this->stringWithNewlines('notes');$data['object_group_id'] = $this->integer('object_group_id');$data['object_group_title'] = $this->string('object_group_title');diff --git a/app/Api/V1/Requests/Models/Tag/StoreRequest.php b/app/Api/V1/Requests/Models/Tag/StoreRequest.phpindex 979baffcee..6b513051d2 100644--- a/app/Api/V1/Requests/Models/Tag/StoreRequest.php+++ b/app/Api/V1/Requests/Models/Tag/StoreRequest.php@@ -47,7 +47,7 @@ class StoreRequest extends FormRequest{$data = ['tag' => $this->string('tag'),- 'date' => $this->date('date'),+ 'date' => $this->getCarbonDate('date'),'description' => $this->string('description'),'has_location' => true,];diff --git a/app/Api/V1/Requests/System/CronRequest.php b/app/Api/V1/Requests/System/CronRequest.phpindex c60af678c8..7b54739c12 100644--- a/app/Api/V1/Requests/System/CronRequest.php+++ b/app/Api/V1/Requests/System/CronRequest.php@@ -62,7 +62,7 @@ class CronRequest extends FormRequest$data['force'] = $this->boolean('force');}if ($this->has('date')) {- $data['date'] = $this->date('date');+ $data['date'] = $this->getCarbonDate('date');}return $data;diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.phpindex 482c9951c6..cc13497c19 100644--- a/app/Http/Requests/AccountFormRequest.php+++ b/app/Http/Requests/AccountFormRequest.php@@ -55,7 +55,7 @@ class AccountFormRequest extends FormRequest'account_number' => $this->string('account_number'),'account_role' => $this->string('account_role'),'opening_balance' => $this->string('opening_balance'),- 'opening_balance_date' => $this->date('opening_balance_date'),+ 'opening_balance_date' => $this->getCarbonDate('opening_balance_date'),'cc_type' => $this->string('cc_type'),'cc_monthly_payment_date' => $this->string('cc_monthly_payment_date'),'notes' => $this->stringWithNewlines('notes'),diff --git a/app/Http/Requests/BillStoreRequest.php b/app/Http/Requests/BillStoreRequest.phpindex 8c9258f526..39f01d8d22 100644--- a/app/Http/Requests/BillStoreRequest.php+++ b/app/Http/Requests/BillStoreRequest.php@@ -46,7 +46,7 @@ class BillStoreRequest extends FormRequest'currency_id' => $this->integer('transaction_currency_id'),'currency_code' => '','amount_max' => $this->string('amount_max'),- 'date' => $this->date('date'),+ 'date' => $this->getCarbonDate('date'),'repeat_freq' => $this->string('repeat_freq'),'skip' => $this->integer('skip'),'notes' => $this->stringWithNewlines('notes'),diff --git a/app/Http/Requests/BillUpdateRequest.php b/app/Http/Requests/BillUpdateRequest.phpindex 9a0a52d9b7..4e6a4bd066 100644--- a/app/Http/Requests/BillUpdateRequest.php+++ b/app/Http/Requests/BillUpdateRequest.php@@ -47,7 +47,7 @@ class BillUpdateRequest extends FormRequest'currency_id' => $this->integer('transaction_currency_id'),'currency_code' => '','amount_max' => $this->string('amount_max'),- 'date' => $this->date('date'),+ 'date' => $this->getCarbonDate('date'),'repeat_freq' => $this->string('repeat_freq'),'skip' => $this->integer('skip'),'notes' => $this->stringWithNewlines('notes'),diff --git a/app/Http/Requests/PiggyBankStoreRequest.php b/app/Http/Requests/PiggyBankStoreRequest.phpindex b9fee6510b..109e64e860 100644--- a/app/Http/Requests/PiggyBankStoreRequest.php+++ b/app/Http/Requests/PiggyBankStoreRequest.php@@ -42,10 +42,10 @@ class PiggyBankStoreRequest extends FormRequest{return ['name' => $this->string('name'),- 'startdate' => $this->date('startdate'),+ 'startdate' => $this->getCarbonDate('startdate'),'account_id' => $this->integer('account_id'),'targetamount' => $this->string('targetamount'),- 'targetdate' => $this->date('targetdate'),+ 'targetdate' => $this->getCarbonDate('targetdate'),'notes' => $this->stringWithNewlines('notes'),'object_group_title' => $this->string('object_group'),];diff --git a/app/Http/Requests/PiggyBankUpdateRequest.php b/app/Http/Requests/PiggyBankUpdateRequest.phpindex bb35919338..2aa30af498 100644--- a/app/Http/Requests/PiggyBankUpdateRequest.php+++ b/app/Http/Requests/PiggyBankUpdateRequest.php@@ -43,10 +43,10 @@ class PiggyBankUpdateRequest extends FormRequest{return ['name' => $this->string('name'),- 'startdate' => $this->date('startdate'),+ 'startdate' => $this->getCarbonDate('startdate'),'account_id' => $this->integer('account_id'),'targetamount' => $this->string('targetamount'),- 'targetdate' => $this->date('targetdate'),+ 'targetdate' => $this->getCarbonDate('targetdate'),'notes' => $this->stringWithNewlines('notes'),'object_group_title' => $this->string('object_group'),];diff --git a/app/Http/Requests/ReconciliationStoreRequest.php b/app/Http/Requests/ReconciliationStoreRequest.phpindex 81866fae41..8fc3ad046c 100644--- a/app/Http/Requests/ReconciliationStoreRequest.php+++ b/app/Http/Requests/ReconciliationStoreRequest.php@@ -48,8 +48,8 @@ class ReconciliationStoreRequest extends FormRequest$transactions = [];}$data = [- 'start' => $this->date('start'),- 'end' => $this->date('end'),+ 'start' => $this->getCarbonDate('start'),+ 'end' => $this->getCarbonDate('end'),'start_balance' => $this->string('startBalance'),'end_balance' => $this->string('endBalance'),'difference' => $this->string('difference'),diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.phpindex a68ad2c351..7ffcddb415 100644--- a/app/Http/Requests/RecurrenceFormRequest.php+++ b/app/Http/Requests/RecurrenceFormRequest.php@@ -59,8 +59,8 @@ class RecurrenceFormRequest extends FormRequest'type' => $this->string('transaction_type'),'title' => $this->string('title'),'description' => $this->string('recurring_description'),- 'first_date' => $this->date('first_date'),- 'repeat_until' => $this->date('repeat_until'),+ 'first_date' => $this->getCarbonDate('first_date'),+ 'repeat_until' => $this->getCarbonDate('repeat_until'),'nr_of_repetitions' => $this->integer('repetitions'),'apply_rules' => $this->boolean('apply_rules'),'active' => $this->boolean('active'),diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.phpindex 4963e8f0c4..e2b17ade5f 100644--- a/app/Http/Requests/TagFormRequest.php+++ b/app/Http/Requests/TagFormRequest.php@@ -45,7 +45,7 @@ class TagFormRequest extends FormRequest{$data = ['tag' => $this->string('tag'),- 'date' => $this->date('date'),+ 'date' => $this->getCarbonDate('date'),'description' => $this->string('description'),];diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.phpindex 3ce46b1500..f7399e6dba 100644--- a/app/Support/Request/ConvertsDataTypes.php+++ b/app/Support/Request/ConvertsDataTypes.php@@ -187,7 +187,7 @@ trait ConvertsDataTypes** @return Carbon|null*/- protected function date(string $field): ?Carbon+ protected function getCarbonDate(string $field): ?Carbon{$result = null;try {