diff --git a/module/Common/src/Util/DateRange.php b/module/Common/src/Util/DateRange.php index 8e156a20..c87f402a 100644 --- a/module/Common/src/Util/DateRange.php +++ b/module/Common/src/Util/DateRange.php @@ -33,4 +33,12 @@ class DateRange { return $this->endDate; } + + /** + * @return bool + */ + public function isEmpty() + { + return is_null($this->startDate) && is_null($this->endDate); + } } diff --git a/module/Core/src/Repository/VisitRepository.php b/module/Core/src/Repository/VisitRepository.php index 7b98c5d5..743427f6 100644 --- a/module/Core/src/Repository/VisitRepository.php +++ b/module/Core/src/Repository/VisitRepository.php @@ -29,7 +29,7 @@ class VisitRepository extends EntityRepository implements VisitRepositoryInterfa $shortUrl = $shortUrl instanceof ShortUrl ? $shortUrl : $this->getEntityManager()->find(ShortUrl::class, $shortUrl); - if (! isset($dateRange)) { + if (! isset($dateRange) || $dateRange->isEmpty()) { $startDate = $shortUrl->getDateCreated(); $endDate = clone $startDate; $endDate->add(new \DateInterval('P2D'));