Fix facebook dates. #271

This commit is contained in:
Michael Teeuw 2016-05-03 11:56:24 +02:00
parent 05a946e2bf
commit 37f8c0783d
3 changed files with 9 additions and 8 deletions

View File

@ -121,10 +121,9 @@ Module.register("calendar",{
if (this.config.displayRepeatingCountTitle) {
repeatingCountTitle = this.countTitleForUrl(event.url)
if(repeatingCountTitle != '') {
repeatingCountTitle = this.countTitleForUrl(event.url);
if(repeatingCountTitle !== '') {
var thisYear = new Date().getFullYear(),
yearDiff = thisYear - event.firstYear;

View File

@ -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()) {

View File

@ -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]);
}
}