Add timezone to date objects

This commit is contained in:
James Cole
2024-11-06 11:57:12 +01:00
parent 038790a5d6
commit 7af9dce33b
22 changed files with 169 additions and 139 deletions

View File

@@ -68,6 +68,7 @@ class Bill extends Model
'user_group_id',
'amount_max',
'date',
'date_tz',
'repeat_freq',
'skip',
'automatch',
@@ -75,6 +76,8 @@ class Bill extends Model
'transaction_currency_id',
'end_date',
'extension_date',
'end_date_tz',
'extension_date_tz',
];
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];

View File

@@ -53,7 +53,7 @@ class PiggyBank extends Model
'encrypted' => 'boolean',
];
protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate', 'targetdate', 'active'];
protected $fillable = ['name', 'account_id', 'order', 'targetamount', 'startdate','startdate_tz', 'targetdate', 'targetdate_tz', 'active'];
protected $hidden = ['targetamount_encrypted', 'encrypted'];

View File

@@ -60,7 +60,7 @@ class Recurrence extends Model
];
protected $fillable
= ['user_id', 'transaction_type_id', 'title', 'description', 'first_date', 'repeat_until', 'latest_date', 'repetitions', 'apply_rules', 'active'];
= ['user_id', 'transaction_type_id', 'title', 'description', 'first_date','first_date_tz', 'repeat_until','repeat_until_tz', 'latest_date','latest_date_tz', 'repetitions', 'apply_rules', 'active'];
/** @var string The table to store the data in */
protected $table = 'recurrences';

View File

@@ -51,7 +51,7 @@ class TransactionJournal extends Model
use SoftDeletes;
protected $casts
= [
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',
@@ -66,7 +66,7 @@ class TransactionJournal extends Model
];
protected $fillable
= [
= [
'user_id',
'user_group_id',
'transaction_type_id',
@@ -93,10 +93,10 @@ class TransactionJournal extends Model
$journalId = (int) $value;
/** @var User $user */
$user = auth()->user();
$user = auth()->user();
/** @var null|TransactionJournal $journal */
$journal = $user->transactionJournals()->where('transaction_journals.id', $journalId)->first(['transaction_journals.*']);
$journal = $user->transactionJournals()->where('transaction_journals.id', $journalId)->first(['transaction_journals.*']);
if (null !== $journal) {
return $journal;
}
@@ -244,14 +244,14 @@ class TransactionJournal extends Model
protected function order(): Attribute
{
return Attribute::make(
get: static fn($value) => (int) $value,
get: static fn ($value) => (int) $value,
);
}
protected function transactionTypeId(): Attribute
{
return Attribute::make(
get: static fn($value) => (int) $value,
get: static fn ($value) => (int) $value,
);
}
}