bug with month view

Assuming the current date is Jan.30, by clicking the next button in Month View. The Calendar view will jump to March instead of Feb.

I add a patch below. it might not be a nice fix, but it works fine to me. Hope it helps.

add: function(date, inc, mode) {
var ndate = new Date(date.valueOf());
switch (mode) {
case “day”: ndate.setDate(ndate.getDate() + inc); break;
case “week”: ndate.setDate(ndate.getDate() + 7 * inc); break;
case “month”: ndate.setMonth(ndate.getMonth() + inc); break;
case “year”: ndate.setYear(ndate.getFullYear() + inc); break;
case “hour”: ndate.setHours(ndate.getHours() + inc); break;
case “minute”: ndate.setMinutes(ndate.getMinutes() + inc); break;
default:
return scheduler.date[“add_” + mode](date, inc, mode);
}
//add a patch
if (ndate.getMonth() - date.getMonth() == 2)
ndate.setMonth(ndate.getMonth() -1);
return ndate;
},

Hi Alvin,

I’m experiencing the same problem as you. I’m a noob to this, could you explain how I can use this patch? Do I insert it into dhtmlxscheduler.js file or in my calendar initialization js file?

Thanks!

Hi Alvin,

I managed to figure it out myself and it works. However, there are still some months loading 2 at a time. When I click on the next month, sometimes it loads 3 months at one go (March 1st to May 1st).

So when I’m on February and I click the next month. It loads March 1st to May 1st. I 'm able to see the events on March, but not on April. I would have to load May and go back to April in order to see the events. Am I not loading something correctly?

	scheduler.config.show_loading = true;
	scheduler.config.first_hour = 7;
	scheduler.config.last_hour = 22;
	scheduler.config.xml_date = "%Y-%m-%d %H:%i";
	scheduler.init('scheduler_here', null, 'month');
	scheduler.setLoadMode("month");
	scheduler.load("/sessions/load_calendar");

Above is my setup for scheduler.

When I click next to see July, no events show up for July, but when I check the response, it’s there in the xml.
I just can’t find what’s wrong…

I used connector_java mode on month view with dhtmlxscheduler.js version 2.1 and it worked well. So I suspected it’s a fixed issue in latest version.

In “Month Veiw”, what happened was when plus 1 to the “month” value, in this case, Jan.30 is changed to Feb.30, but Feb.30 doesn’t exit, so when trigger the event to move to next month view, the .setMonth(ndate.getMonth() + inc) returns a date in March without a error message.

you will need to fix this issue somewhere. Hope the patch I made can give you a hint, and could help you could figure out a better way to fix the issue.

Thanks,
Alvin Huan

Problem is confirmed, and it is actual for all versions of scheduler, including the latest one.

Patch for version 2.1 can be downloaded from
support.dhtmlx.com/x-files/sched … _patch.zip
( just add the patch file on a page, after dhtmlxscheduler.js, or to the end of dhtmlxscheduler.js )

We will include fix in the next version.

By the way, patch suggestion from the original post fixes issue as well, but I think it can cause some misbehavior for recurring events.

Thank you for the month_patch.js, that was really useful. And thanks to Alvin as well.

I also have another issue with month_view. It’s not behaving the way it should.
When I load it up for this month February, the request goes something like:

http://machinename:5000/sessions/load_calendar?timeshift=-480&from=2010-02-01&to=2010-03-01

However, when I click the next button for the next month (March) the request changes to something like:

http://machinename:5000/sessions/load_calendar?timeshift=-480&from=2010-03-01&to=2010-05-01

Why does it load 2 months at one go? Every other request after that is by a per month basis. This is causing my events for April not showing up even though the response from the second request returns the correct pieces of XML for the month of April.

The response returns both March and April events correctly in XML. However, it’s just not showing up in the Calendar the first time through. I would have to click to the next/previous month then go back to April to see the events.

Anyone else experiencing this?

http://machinename:5000/sessions/load_calendar?timeshift=-480&from=2010-03-01&to=2010-05-01

Data request is fully correct

March view contains visible dates 01 March - 04 April ( few April’s day are necessary to finish the week ). So scheduler takes data for both March and April to be sure that those 4 days will be filled with events.

If data request is correct, then why is it that when I check for events of April the first time around, nothing shows up, however, if I continue going forward to load other months then go back to April, events for the month of April appear again?

It is true that when I am in the month view of March, I do get to see one of my events created for April 4th at the bottom, but when I change the month view to April, everything, even April 4th is empty. I’m very sure that the returned xml had events for April 4th to 7th.

Have you ever experienced this before?

Nope, there were no similar problem reports.

Do you have some kind of demo link, where issue can be checked?

I’m sorry, but I don’t have any link. I wish I could provide you with one, but this is an internal project.

It’s so strange…XML correct but it just doesn’t load April correctly. Likewise for the months July and August. Shows up blank initially, then when you go back to it, the events all of a sudden start to appear.

How about fetched xml data for march-april - can you grab it and post here?