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
This commit is contained in:
Andreas Brauchli 2014-09-17 15:34:40 -10:00 committed by Michael Catanzaro
parent 6c67f26e7d
commit aee1a18270

View File

@ -382,6 +382,12 @@ const DBusEventSource = new Lang.Class({
result.push(event); 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; return result;
}, },