Timeline Month view skips months on Backward Arrow Click

Hello,

I’ve just noticed an alarming issue with my timeline month view.

When i click the forward arrow, all months appear normally. However when i click the back arrow it is consistantly skipping the following months.

February
April
June
September
November

I think it has something to do with the amount of days in the month…

For example when I am viewing the month “1 Mar 2014 - 31 Mar 2014” and click the back arrow the month that is loaded is “1 Jan 2014 - 31 Jan 2014”.

Where did February go?

I am generating the view with the following code:

scheduler.createTimelineView({ name: "timeline_month", x_unit: "day", x_date: "%D %d", x_step: 1, x_size: 31, x_length: 31, section_autoheight: false, y_unit: scheduler.serverList("sections"), y_property: "res_id", render:"tree", folder_dy:20, dy:60, dx:280 });

Thanks

Hi,
this configuration skips the month with <31 days.

x_size: 31, x_length: 31,
Hope this topic will help you:
viewtopic.php?f=6&t=36436

Hello Serge,

Thank-you for the tip.

Unfortunately I am still getting skipped months when I step backwards. The months are dynamically adjusting to show the correct amount of days.

This is my faulty code

scheduler.createTimelineView({
    name:	"timeline_month",
    x_unit:	"day",
    x_date:	"%D %d",
    x_step:	1,
    x_size: 31,
    x_start: 0,
    x_length: 31,
    section_autoheight: false,
    y_unit:	scheduler.serverList("sections"),
    y_property: "res_id",
    render:"tree",
    folder_dy:20,
    dy:60,
    dx:280
});

scheduler.attachEvent("onBeforeViewChange", function(old_mode,old_date,mode,date){
    var year = date.getFullYear();
    var month= (date.getMonth() + 1);
    var d = new Date(year, month, 0);
    var days = d.getDate();//numbers of day in month
    scheduler.matrix['timeline_month'].x_size = days;
    scheduler.matrix['timeline_month'].x_length = days;
    return true;
});
scheduler.date.timeline_start = scheduler.date.month_start;

Do you have anymore ideas?

Hello,
you can try overwriting the function that changes the date of the timeline in order to make switch months instead of fixed number of days
Check the working snippet
docs.dhtmlx.com/scheduler/snippet/16b2d51b