From a23809e66d9e3c0a0bb4c151e8052a3464f304f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20Ba=C5=A1i=C4=87?= Date: Mon, 22 Oct 2018 01:13:27 +0200 Subject: [PATCH] Fix for start date end date issue --- src/Traits/Reports.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Traits/Reports.php b/src/Traits/Reports.php index 147176c..a454746 100644 --- a/src/Traits/Reports.php +++ b/src/Traits/Reports.php @@ -30,10 +30,10 @@ public function getHoursLoggedFor($startDate, $endDate, $project = null, $branch */ public function getHoursLoggedForLast($period, $project = null, $branches = null) { - $todayDate = date('m/d/Y'); - $endDate = date_format(date_sub(date_create($todayDate), date_interval_create_from_date_string($period)), 'm/d/Y'); + $endDate = date('m/d/Y'); + $startDate = date_format(date_sub(date_create($todayDate), date_interval_create_from_date_string($period)), 'm/d/Y'); - return $this->getHoursLoggedFor($todayDate, $endDate, $project, $branches); + return $this->getHoursLoggedFor($startDate, $endDate, $project, $branches); } /** @@ -100,8 +100,8 @@ public function getHoursLoggedForLast30Days($project = null, $branches = null) */ public function getHoursLoggedForThisMonth($project = null, $branches = null) { - $endDate = date('m/01/Y'); - $startDate = date('m/d/Y'); + $startDate = date('m/01/Y'); + $endDate = date('m/d/Y'); return $this->getHoursLoggedFor($startDate, $endDate, $project, $branches); } @@ -116,8 +116,8 @@ public function getHoursLoggedForThisMonth($project = null, $branches = null) */ public function getHoursLoggedForLastMonth($project = null, $branches = null) { - $endDate = date_format(date_sub(date_create(), date_interval_create_from_date_string('1 month')), 'm/01/Y'); - $startDate = date_format(date_sub(date_create(), date_interval_create_from_date_string('1 month')), 'm/t/Y'); + $startDate = date_format(date_sub(date_create(), date_interval_create_from_date_string('1 month')), 'm/01/Y'); + $endDate = date_format(date_sub(date_create(), date_interval_create_from_date_string('1 month')), 'm/t/Y'); return $this->getHoursLoggedFor($startDate, $endDate, $project, $branches); }