From 441cd617c5e67745875621cda930f0821e1a4915 Mon Sep 17 00:00:00 2001 From: "mikep%oeone.com" Date: Thu, 20 Feb 2003 16:10:15 +0000 Subject: [PATCH] Fixing problem with sorting events not working if they happen at the same time, bug 189710 --- calendar/resources/content/calendarEvent.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/calendar/resources/content/calendarEvent.js b/calendar/resources/content/calendarEvent.js index 47fad627f412..34f6ed590b48 100644 --- a/calendar/resources/content/calendarEvent.js +++ b/calendar/resources/content/calendarEvent.js @@ -20,6 +20,7 @@ * * Contributor(s): Garth Smedley * Mike Potter + * Chris Allen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -541,21 +542,14 @@ CalendarEventDataSource.prototype.orderToDosByDueDate = function calEvent_orderT CalendarEventDataSource.prototype.orderEventsByDisplayDate = function calEvent_orderEventsByDisplayDate( eventA, eventB ) { - var eventADisplayDate = new Date( eventA.displayDate ); - var eventBDisplayDate = new Date( eventB.displayDate ); - - if( eventADisplayDate.getFullYear() == eventBDisplayDate.getFullYear() && - eventADisplayDate.getMonth() == eventBDisplayDate.getMonth() && - eventADisplayDate.getDay() == eventBDisplayDate.getDay() && - eventADisplayDate.getHours() == eventBDisplayDate.getHours() && - eventADisplayDate.getMinutes() == eventBDisplayDate.getMinutes() ) + var r=eventA.displayDate - eventB.displayDate; + if (r==0) { - if ( eventA.title < eventB.title ) return -1; - if ( eventA.title > eventB.title ) return 1; - return 0; + if ( eventA.title < eventB.title ) r=-1; + if ( eventA.title > eventB.title ) r=1; } - - return( eventA.displayDate - eventB.displayDate ); + + return(r); }