Correct tag date and add warning.

This commit is contained in:
James Cole
2025-07-30 07:26:50 +02:00
parent 333004c4d9
commit 3d65f00c6e

View File

@@ -154,12 +154,18 @@ class TagController extends Controller
*/
public function index(TagRepositoryInterface $repository)
{
// start with oldest tag
// start with the oldest tag
$first = session('first', today()) ?? today();
$oldestTagDate = $repository->oldestTag() instanceof Tag ? $repository->oldestTag()->date : clone $first;
$newestTagDate = $repository->newestTag() instanceof Tag ? $repository->newestTag()->date : today();
$oldestTagDate->startOfYear();
$newestTagDate->endOfYear();
if($oldestTagDate->year < 1970) {
$oldestTagDate = Carbon::create(1970, 1, 1, 0, 0, 0, config('app.timezone'));
request()->session()->flash('error', trans('firefly.bad_date_transaction'));
}
$tags = [];
$tags['no-date'] = $repository->getTagsInYear(null);