From 807dede90abe9fc9761a07cfaa2cbc90efcc3d7d Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 10 Feb 2016 06:55:08 +0100 Subject: [PATCH] Because nextExpectedMatch() must return a date (and cannot return null) the list of bills will show "unknown" when the bill is next expected in 1900. --- app/Repositories/Bill/BillRepository.php | 3 ++- resources/views/list/bills.twig | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 460f3effb3..28ebe99313 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -399,7 +399,8 @@ class BillRepository implements BillRepositoryInterface public function nextExpectedMatch(Bill $bill): Carbon { - $finalDate = Carbon::now()->subDays(2); + $finalDate = Carbon::now(); + $finalDate->year = 1900; if ($bill->active == 0) { return $finalDate; } diff --git a/resources/views/list/bills.twig b/resources/views/list/bills.twig index 7b95561765..50747535aa 100644 --- a/resources/views/list/bills.twig +++ b/resources/views/list/bills.twig @@ -45,14 +45,14 @@ {% endif %} - {% if entry.nextExpectedMatch.isFuture %} - - {{ entry.nextExpectedMatch.formatLocalized(monthAndDayFormat) }} - - {% else %} + {% if entry.nextExpectedMatch.year == 1900 %} {{ 'unknown'|_ }} + {% else %} + + {{ entry.nextExpectedMatch.formatLocalized(monthAndDayFormat) }} + {% endif %}