[gnome-shell] dateMenu: Don't manipulate passed events



commit 0fded45c7604e5df546418e9e7bfdc0c6245d1d9
Author: Björn Daase <bjoern daase net>
Date:   Tue Feb 15 11:21:48 2022 +0100

    dateMenu: Don't manipulate passed events
    
    The event passed to formatEventTime() is reused at a later point.
    Therefore, we are not allowed to manipulate the event directly.
    This fixes an issue where the user clicks on a multi-day all-day event
    the second time before the event gets garbage collected and the event
    then is one day shorter.
    
    Fixes 528ee01fef6e5ca2303fc766be29a854d8ee928b
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2184>

 js/ui/dateMenu.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/dateMenu.js b/js/ui/dateMenu.js
index 8ed1a579b0..55c12ebe13 100644
--- a/js/ui/dateMenu.js
+++ b/js/ui/dateMenu.js
@@ -175,7 +175,7 @@ class EventsSection extends St.Button {
 
     _formatEventTime(event) {
         const eventStart = event.date;
-        const eventEnd = event.end;
+        let eventEnd = event.end;
 
         const allDay =
             eventStart.getTime() === this._startDate.getTime() && eventEnd.getTime() === 
this._endDate.getTime();
@@ -203,8 +203,10 @@ class EventsSection extends St.Button {
 
             const startYear = eventStart.getFullYear();
 
-            if (endsAtMidnight)
+            if (endsAtMidnight) {
+                eventEnd = new Date(eventEnd);
                 eventEnd.setDate(eventEnd.getDate() - 1);
+            }
 
             const endYear = eventEnd.getFullYear();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]