How to set Start date to customized timeline view

Hi Team,

Can you please help me how to set the start date to a time line view? (i have customised time line view to be a week view, by adding x-unit : day, x-date : %D, %j-%M)

scheduler.createTimelineView({
name: “day_line”,
x_unit: “day”,
x_date: “%D, %j-%M”,
x_step: 1,
x_start : 0,
x_size: 7,
x_length: 7,
y_unit: evt,
y_property:“section_id”,
render: “bar”
});

But when I am loading data, its always starting from 7days before. Like if today is 10th september. When I click on the Week (Timeline) View. Its initialized from 3rd September.

But I want the week to be started from current Mon day. I.e., 8th september.

I tried below lines of code too. but it didnt workout.

scheduler.config.start_on_monday = true;
scheduler.config.start_timeline_on_monday = true;

Can you please help??

Please find attached screenshot for more clear understanding.

Thanks.


Hi,
you can redefine a ‘view start’ function, that returns a start date of the displayed view. Such function is defined for each view of the scheduler. The function must be named as ‘viewName_start’ and be defined in scheduler.date object.
Add this code after ‘scheduler.createTimelineView’

scheduler.date.day_line_start = function(date){ return scheduler.date.week_start(date); };

Thanks, it worked.

I wrote the below code after creating timeline.

scheduler.date.day_line_start = scheduler.date.week_start;