LibreBooking / app

Repository for the last open source version of Booked Scheduler. The "develop" branch contains the most current working code of the project and should be considered beta. The "master" branch is the most current stable release of BookedScheduler. Please read doc/README.md for further details.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Previous button behaving the same as Next button - View Bookings/Schedules

bravismore-mugadza opened this issue · comments

The Previous button behaving the same as Next button when viewing Bookings/Schedules
previous button

It seems to me that this bug is fixed in Git already but not released now.

For me this hot-fix worked:

--- ./lib/Common/Date.php.orig	2023-09-13 11:09:58.833684809 +0200
+++ ./lib/Common/Date.php	2023-09-13 11:25:09.534329873 +0200
@@ -439,6 +439,11 @@
         return !$this->IsWeekday();
     }
 
+    private function getOperator(int $number): string
+    {
+        return $number < 0 ? " -" : " +";
+    }
+
     /**
      * @param int $days
      * @return Date
@@ -446,7 +451,7 @@
     public function AddDays($days)
     {
         // can also use DateTime->modify()
-        return new Date($this->Format(self::SHORT_FORMAT) . " +" . $days . " days", $this->timezone);
+        return new Date($this->Format(self::SHORT_FORMAT) . $this->getOperator($days) . abs($days) . " days", $this->timezone);
     }
 
     /**

Applied the hot fix and indeed it fixed the anomaly.