mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Fix facebook dates. #271
This commit is contained in:
parent
05a946e2bf
commit
37f8c0783d
@ -121,10 +121,9 @@ Module.register("calendar",{
|
||||
|
||||
if (this.config.displayRepeatingCountTitle) {
|
||||
|
||||
repeatingCountTitle = this.countTitleForUrl(event.url)
|
||||
repeatingCountTitle = this.countTitleForUrl(event.url);
|
||||
|
||||
if(repeatingCountTitle != '') {
|
||||
|
||||
if(repeatingCountTitle !== '') {
|
||||
var thisYear = new Date().getFullYear(),
|
||||
yearDiff = thisYear - event.firstYear;
|
||||
|
||||
|
@ -55,14 +55,16 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
|
||||
if (event.type === "VEVENT") {
|
||||
|
||||
//console.log(event);
|
||||
|
||||
var startDate = (event.start.length === 8) ? moment(event.start, "YYYYMMDD") : moment(new Date(event.start));
|
||||
var endDate;
|
||||
if (typeof event.end !== "undefined") {
|
||||
endDate = (event.end.length === 8) ? moment(event.end, "YYYYMMDD") : moment(new Date(event.end));
|
||||
} else {
|
||||
endDate = startDate;
|
||||
if (!isFacebookBirthday) {
|
||||
endDate = startDate;
|
||||
} else {
|
||||
endDate = moment(startDate).add(1, 'days');
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the duration f the event for use with recurring events.
|
||||
@ -92,7 +94,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
} else {
|
||||
// console.log("Single event ...");
|
||||
// Single event.
|
||||
var fullDayEvent = isFullDayEvent(event);
|
||||
var fullDayEvent = (isFacebookBirthday) ? true : isFullDayEvent(event);
|
||||
var title = (typeof event.summary.val !== "undefined") ? event.summary.val : event.summary;
|
||||
|
||||
if (!fullDayEvent && endDate < new Date()) {
|
||||
|
@ -32,7 +32,7 @@ ical.objectHandlers['END'] = function(val, params, curr, stack){
|
||||
if (curr.start.length === 8) {
|
||||
var comps = /^(\d{4})(\d{2})(\d{2})$/.exec(curr.start);
|
||||
if (comps) {
|
||||
curr.start = new Date (comps[1], comps[2], comps[3]);
|
||||
curr.start = new Date (comps[1], comps[2] - 1, comps[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user