timetracker icon indicating copy to clipboard operation
timetracker copied to clipboard

Goals do not count work log entries that start before Monday 11:00 AM

Open steglicd opened this issue 4 years ago • 1 comments

if I Add a goal with 40h / week and then add a record: Monday 09:00 - 17:00, then this record is not counted for that goal. Adding a record: 11:00 - 19:00 is counted as 8h for that goal.

This patch fixes the issue for me:

diff --git a/lib/Controller/AjaxController.php b/lib/Controller/AjaxController.php
index ef8c9e8..9b767cb 100644
--- a/lib/Controller/AjaxController.php
+++ b/lib/Controller/AjaxController.php
@@ -1176,7 +1176,8 @@ class AjaxController extends Controller {
                $year = $date->format("Y");
                $weekstartdt = new \DateTime();
                $weekstartdt->setISODate($year, $weeknumber);
-
+                $hours = 11;
+                $weekstartdt->sub(new \DateInterval("PT{$hours}H"));
                return $weekstartdt;
        }
        public function getStartOfMonth($timestamp){

seems like returned timestamp from a DateTime object which is configured by setISODate() is not set to 00:00 of that day. So weeks start at Monday 11:00 in my case (but I#m not sure if this is TimeZone related).

steglicd avatar Feb 04 '21 11:02 steglicd

Yes, all the reporting done server side is in UTC. Individual times are converted in local timezone by the clients depending on their individual location (or timezone settings).

puthre avatar Feb 04 '21 11:02 puthre