mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-30 10:33:30 +00:00
Fix date issues.
This commit is contained in:
@@ -553,9 +553,14 @@ class GroupCollector implements GroupCollectorInterface
|
||||
$result['tags'] = [];
|
||||
$result['attachments'] = [];
|
||||
try {
|
||||
$result['date'] = new Carbon($result['date']);
|
||||
$result['created_at'] = new Carbon($result['created_at']);
|
||||
$result['updated_at'] = new Carbon($result['updated_at']);
|
||||
$result['date'] = new Carbon($result['date'], 'UTC');
|
||||
$result['created_at'] = new Carbon($result['created_at'], 'UTC');
|
||||
$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) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
|
@@ -46,10 +46,8 @@ class ShowController extends Controller
|
||||
{
|
||||
use UserNavigation, PeriodOverview;
|
||||
|
||||
/** @var CurrencyRepositoryInterface The currency repository */
|
||||
private $currencyRepos;
|
||||
/** @var AccountRepositoryInterface The account repository */
|
||||
private $repository;
|
||||
private CurrencyRepositoryInterface $currencyRepos;
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* ShowController constructor.
|
||||
|
@@ -211,16 +211,20 @@ class BillController extends Controller
|
||||
/** @var Collection $bills */
|
||||
$bills = $unfiltered->map(
|
||||
function (Bill $bill) use ($transformer, $defaultCurrency) {
|
||||
$return = $transformer->transform($bill);
|
||||
$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);
|
||||
$currency = $bill->transactionCurrency ?? $defaultCurrency;
|
||||
$return['currency_id'] = $currency->id;
|
||||
$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 = $transformer->transform($bill);
|
||||
$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
|
||||
);
|
||||
$currency = $bill->transactionCurrency ?? $defaultCurrency;
|
||||
$return['currency_id'] = $currency->id;
|
||||
$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;
|
||||
}
|
||||
|
@@ -121,18 +121,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property-read int|null $transaction_journal_meta_count
|
||||
* @property-read int|null $transactions_count
|
||||
* @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
|
||||
{
|
||||
|
Reference in New Issue
Block a user