mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Fix calendar sorting.
This commit is contained in:
parent
736bf55bd8
commit
0d4164a03e
@ -16,9 +16,6 @@ calendar.updateData = function (callback) {
|
|||||||
this.eventList = [];
|
this.eventList = [];
|
||||||
|
|
||||||
for (var i in events) {
|
for (var i in events) {
|
||||||
if (this.eventList.length >= calendar.maximumEntries) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var e = events[i];
|
var e = events[i];
|
||||||
for (var key in e) {
|
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});
|
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]') {
|
if (callback !== undefined && Object.prototype.toString.call(callback) === '[object Function]') {
|
||||||
callback(this.eventList);
|
callback(this.eventList);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user