Scheduler Pro - Show year at default date position

Hi everyone,

I’m trying the timeline view now and would it be possible to show year as ‘2023’ not ‘2023 - 2023’ by the below setting?

scheduler.config.default_date = '%Y'

Currently, it’s as below:

It would be great if there is something official setting option.
Thank you for your support in advance.

meicom

Hello @meicom,

You can change the format of the date in the header with the template function of the specific view,
here is a template for the timeline view:
https://docs.dhtmlx.com/scheduler/api__scheduler_{timelinename}_date_template.html
template for week view:
https://docs.dhtmlx.com/scheduler/api__scheduler_week_date_template.html

The code for week view may look like follows:

var dateToStr = scheduler.date.date_to_str("%Y");

scheduler.templates.week_date = function(start, end){
    return dateToStr(start);
};

Here is a demo:
https://snippet.dhtmlx.com/76rcg3g4

You can find templates for each view in the article related to the required view:
https://docs.dhtmlx.com/scheduler/views.html

Kind regards,

Hi Siarhei,

Great, the issue was fixed on my end using the option. Thank you for your kind help.

Best regards,

meicom

1 Like