mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 02:26:58 +00:00
Fix date issues.
This commit is contained in:
@@ -553,9 +553,14 @@ class GroupCollector implements GroupCollectorInterface
|
|||||||
$result['tags'] = [];
|
$result['tags'] = [];
|
||||||
$result['attachments'] = [];
|
$result['attachments'] = [];
|
||||||
try {
|
try {
|
||||||
$result['date'] = new Carbon($result['date']);
|
$result['date'] = new Carbon($result['date'], 'UTC');
|
||||||
$result['created_at'] = new Carbon($result['created_at']);
|
$result['created_at'] = new Carbon($result['created_at'], 'UTC');
|
||||||
$result['updated_at'] = new Carbon($result['updated_at']);
|
$result['updated_at'] = new Carbon($result['updated_at'], 'UTC');
|
||||||
|
|
||||||
|
// this is going to happen a lot:
|
||||||
|
$result['date']->setTimezone(env('TZ'));
|
||||||
|
$result['created_at']->setTimezone(env('TZ'));
|
||||||
|
$result['updated_at']->setTimezone(env('TZ'));
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error($e->getMessage());
|
Log::error($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@@ -46,10 +46,8 @@ class ShowController extends Controller
|
|||||||
{
|
{
|
||||||
use UserNavigation, PeriodOverview;
|
use UserNavigation, PeriodOverview;
|
||||||
|
|
||||||
/** @var CurrencyRepositoryInterface The currency repository */
|
private CurrencyRepositoryInterface $currencyRepos;
|
||||||
private $currencyRepos;
|
private AccountRepositoryInterface $repository;
|
||||||
/** @var AccountRepositoryInterface The account repository */
|
|
||||||
private $repository;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ShowController constructor.
|
* ShowController constructor.
|
||||||
|
@@ -211,16 +211,20 @@ class BillController extends Controller
|
|||||||
/** @var Collection $bills */
|
/** @var Collection $bills */
|
||||||
$bills = $unfiltered->map(
|
$bills = $unfiltered->map(
|
||||||
function (Bill $bill) use ($transformer, $defaultCurrency) {
|
function (Bill $bill) use ($transformer, $defaultCurrency) {
|
||||||
$return = $transformer->transform($bill);
|
$return = $transformer->transform($bill);
|
||||||
$nextExpectedMatch = new Carbon($return['next_expected_match']);
|
$nextExpectedMatch = new Carbon($return['next_expected_match']);
|
||||||
$return['next_expected_match_diff'] = $nextExpectedMatch->isToday() ? trans('firefly.today') : $nextExpectedMatch->diffForHumans(today(), Carbon::DIFF_RELATIVE_TO_NOW);
|
$return['next_expected_match_diff'] = $nextExpectedMatch->isToday()
|
||||||
$currency = $bill->transactionCurrency ?? $defaultCurrency;
|
? trans('firefly.today')
|
||||||
$return['currency_id'] = $currency->id;
|
: $nextExpectedMatch->diffForHumans(
|
||||||
$return['currency_name'] = $currency->name;
|
today(), Carbon::DIFF_RELATIVE_TO_NOW
|
||||||
$return['currency_symbol'] = $currency->symbol;
|
);
|
||||||
$return['currency_code'] = $currency->code;
|
$currency = $bill->transactionCurrency ?? $defaultCurrency;
|
||||||
$return['currency_decimal_places'] = $currency->decimal_places;
|
$return['currency_id'] = $currency->id;
|
||||||
$return['attachments'] = $this->billRepository->getAttachments($bill);
|
$return['currency_name'] = $currency->name;
|
||||||
|
$return['currency_symbol'] = $currency->symbol;
|
||||||
|
$return['currency_code'] = $currency->code;
|
||||||
|
$return['currency_decimal_places'] = $currency->decimal_places;
|
||||||
|
$return['attachments'] = $this->billRepository->getAttachments($bill);
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@@ -121,18 +121,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property-read int|null $transaction_journal_meta_count
|
* @property-read int|null $transaction_journal_meta_count
|
||||||
* @property-read int|null $transactions_count
|
* @property-read int|null $transactions_count
|
||||||
* @method static EloquentBuilder|TransactionJournal whereTransactionGroupId($value)
|
* @method static EloquentBuilder|TransactionJournal whereTransactionGroupId($value)
|
||||||
* @property int $user_id
|
|
||||||
* @property int|null $transaction_group_id
|
|
||||||
* @property int|null $transaction_currency_id
|
|
||||||
* @property \Illuminate\Support\Carbon|null $interest_date
|
|
||||||
* @property \Illuminate\Support\Carbon|null $book_date
|
|
||||||
* @property \Illuminate\Support\Carbon|null $process_date
|
|
||||||
* @property int $order
|
|
||||||
* @property bool $encrypted
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
|
|
||||||
* @property-read \FireflyIII\Models\TransactionGroup|null $transactionGroup
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournalMeta[] $transactionJournalMeta
|
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
|
||||||
*/
|
*/
|
||||||
class TransactionJournal extends Model
|
class TransactionJournal extends Model
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user