From: Michael Prager Date: Mon, 21 Mar 2011 15:01:20 +0000 (+0100) Subject: fixed sorting for events without dates X-Git-Url: https://code.delx.au/comingnext/commitdiff_plain/ec325e40b6f6bc5d73da616b7cdf235ea26108e3 fixed sorting for events without dates --- diff --git a/Readme.txt b/Readme.txt index 634fdb5..d3856e0 100644 --- a/Readme.txt +++ b/Readme.txt @@ -259,3 +259,4 @@ Changelog: - added spanish translation (thanks to dragomerlin) - added italian translation (thanks to Marcella Ferrari and Venos) - fixed "About" link opening inside browser instead of widget + - fixed sorting of events without date diff --git a/comingNext/index.html b/comingNext/index.html index bc731c4..cd61eaa 100644 --- a/comingNext/index.html +++ b/comingNext/index.html @@ -1434,6 +1434,33 @@ function sortCalendarEntries(a, b) } } } + // NOTE: events my have no date information at all. In that case, we list events without date first + else if (atime && !btime) { + return 1; + } + else if (!atime && btime) { + return -1; + } + else if (!atime && !btime) { + // sort by type + if (a.Type != b.Type) { + if (a.Type < b.Type) { + return -1; + } + else if (a.Type > b.Type) { + return 1; + } + } + // sort by description + else if (a.Summary && b.Summary && a.Summary != b.Summary) { + if (a.Summary < b.Summary) { + return -1; + } + else if (a.Summary > b.Summary) { + return 1; + } + } + } return 0; }