How to change only format for one day scheduler.template.timeline_date


#1

Hi,

i want to change the format of the timeline header date to show also the week day like monday to sunday.
For example now it shows “2 Jun 2021” and i want “2 Jun 2021 - Wed”

I know there is this “scheduler.template.timeline_date” but i am not sure how to use. May you can help me.

Thanks.

BR
René


#2

Hello @IFM ,

The timeline_date template is a function that takes the start/end dates of the timeline and returns the content that will be displayed in the header of the timeline.

In order to change the format of the displayed data, you can use the date_to_str method, in order to convert start/end dates into a required string(format), in your case it may look like follows:

var dateToStr = scheduler.date.date_to_str("%d %M %Y-%D");
scheduler.templates.timeline_date = function(date1, date2){
        return dateToStr(date1);  
};

Here is a demo:
http://snippet.dhtmlx.com/5/cf733329c


#3

Thanks a lot.

Thats what i needed and also thanks for the nice explanation and even with demo.

Good service / support.

BR
René