[gnome-shell] Calendar: sort multi-day events by ending day/time



commit 62b6419332e4c19f08a59cad915cca4c4663a179
Author: Andreas Brauchli <a brauchli elementarea net>
Date:   Wed Sep 17 15:34:40 2014 -1000

    Calendar: sort multi-day events by ending day/time
    
    With commit dc6a60dde, the calendar displays the ending day and time of
    a continuing multi-day event on its ending day. This results in the list
    not appearing to be sorted. This patch sorts the list according to the
    displayed day/time.
    
    With the two appointments
    Thursday 0800-1000 Foo, and Wednesday 0900-Friday 1200 Bar and today
    being Monday, the rest of the week list currently displays:
    F ...1200 Bar
    T    0800 Foo
    With this patch, the displaying order is switched because Friday comes
    after Thursday.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727302

 js/ui/calendar.js |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index 3899ecb..2c43689 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -383,6 +383,12 @@ const DBusEventSource = new Lang.Class({
                 result.push(event);
             }
         }
+        result.sort(function(event1, event2) {
+            // sort events by end time on ending day
+            let d1 = event1.date < begin && event1.end <= end ? event1.end : event1.date;
+            let d2 = event2.date < begin && event2.end <= end ? event2.end : event2.date;
+            return d1.getTime() - d2.getTime();
+        });
         return result;
     },
 


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