Read the statement by Michael Teeuw here.
Default Calendar module // request to show events only if start date > today + 2 days
-
@ganget
no problem. thanks for the idea.
I was thinking about modifying the module code to change “today’s” date into “today’s date +2” but can’t yet figure out how too. -
the existing code is.
if (event.startDate >= new Date()) {
and ideas on how to add days to today or whatever
https://stackoverflow.com/questions/3818193/how-to-add-number-of-days-to-todays-date
-
@sdetweil
Thanks, I will give it a try this evening and keep you guys posted. -
@sdetweil
Hi again, I just tried by modifying the createEventList “today” and “now” variable, but it didn’t work…createEventList: function () { var events = []; var someDate = new Date(); var numberOfDaysToAdd = 6; someDate.setDate(someDate.getDate() + numberOfDaysToAdd); var today = moment(someDate).startOf("day"); var now = someDate; for (var c in this.calendarData) {
-
@bolish close…
the existing loop takes ALL events, just checking to see if each event is TODAY (sets a flag)
to eliminate them you need one more test (in addition to the rest of your code above)
var someDate = new Date(); var numberOfDaysToAdd = 6; someDate.setDate(someDate.getDate() + numberOfDaysToAdd); var today = moment(someDate).startOf("day"); //var today = moment().startOf("day"); for (var c in this.calendarData) { var calendar = this.calendarData[c]; for (var e in calendar) { var event = calendar[e]; // if event happens further away than x number of days (6 in this sample) if(event.startDate>= today) { < ------ if(this.config.hidePrivate) { if(event.class === "PRIVATE") { // do not add the current event, skip it continue; } } event.url = c; event.today = event.startDate >= today && event.startDate < (today + 24 * 60 * 60 * 1000); events.push(event); } } }
-
@sdetweil
Works like a charm.
Thank you very much, I’ve learnt something thanks to you and appreciated your support for debug.
See you around.