Skip to content

Commit 7f22e9a

Browse files
author
Koen Konst
committed
Fixed script issue in calendar.js, both moment and moment-timezone data should be loaded. Also fixed a bug when determining new recurring events with an original timezone
1 parent 93c833b commit 7f22e9a

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

modules/default/calendar/calendar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Module.register("calendar", {
7777

7878
// Define required scripts.
7979
getScripts () {
80-
return ["calendarutils.js", "moment-timezone.js"];
80+
return ["calendarutils.js", "moment-timezone.js", "moment.js"];
8181
},
8282

8383
// Define required translations.

modules/default/calendar/calendarfetcherutils.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,9 @@ const CalendarFetcherUtils = {
112112
return JSON.stringify(d) !== "null";
113113
});
114114

115-
console.log(dates);
116-
console.log(event);
117-
118115
// Dates are returned in UTC timezone but with localdatetime because tzid is null.
119116
// So we map the date to a moment using the original timezone of the event.
120-
return dates.map((d) => (event.start.tz ? moment(d).tz(event.start.tz, true) : moment(d)));
117+
return dates.map((d) => (event.start.tz ? moment.tz(d, "UTC").tz(event.start.tz, true) : moment.tz(d, "UTC").tz(moment.tz.guess(), true)));
121118
},
122119

123120
/**
@@ -200,13 +197,9 @@ const CalendarFetcherUtils = {
200197
// Recurring event.
201198
let moments = CalendarFetcherUtils.getMomentsFromRecurringEvent(event, pastLocalMoment, futureLocalMoment);
202199

203-
console.log(moments);
204-
205200
// Loop through the set of moment entries to see which recurrences should be added to our event list.
206201
// TODO This should create an event per moment so we can change anything we want.
207202
for (let m in moments) {
208-
console.log(typeof moments[m]);
209-
console.log(moments[m]);
210203
let curEvent = event;
211204
let showRecurrence = true;
212205
let recurringEventStartMoment = moments[m].tz(moment.tz.guess()).clone();

0 commit comments

Comments
 (0)