mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
Fix calendar sorting.
This commit is contained in:
parent
736bf55bd8
commit
0d4164a03e
@ -16,9 +16,6 @@ calendar.updateData = function (callback) {
|
||||
this.eventList = [];
|
||||
|
||||
for (var i in events) {
|
||||
if (this.eventList.length >= calendar.maximumEntries) {
|
||||
break;
|
||||
}
|
||||
|
||||
var e = events[i];
|
||||
for (var key in e) {
|
||||
@ -94,6 +91,9 @@ calendar.updateData = function (callback) {
|
||||
|
||||
this.eventList = this.eventList.sort(function(a,b){return a.seconds-b.seconds});
|
||||
|
||||
// Limit the number of entries.
|
||||
this.eventList = this.eventList.slice(0, calendar.maximumEntries);
|
||||
|
||||
if (callback !== undefined && Object.prototype.toString.call(callback) === '[object Function]') {
|
||||
callback(this.eventList);
|
||||
}
|
||||
@ -134,4 +134,4 @@ calendar.init = function () {
|
||||
this.updateData(this.updateCalendar.bind(this));
|
||||
}.bind(this), this.updateDataInterval);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user