Scheduler - markedtimespan for only day and week view

Hi ,

I am using this config in my app.

   this.timespanId = scheduler.addMarkedTimespan({
      days:  new Date(),
      zones: [0*60,toTime], // 12 am to current time
      css:   "gray_section",
      type:  "dhx_time_block",
    });
    scheduler.updateView();

This will mark and block current day and till current time.
Now this works perfectly for day and week view. Since month view does not have any time slots , I dont want to block the whole current day in it. How can apply this config only for day and week view?Or how to only mark and not block dates in month view?

Hello @rajeswarij,

Regarding blocking full day in month view - you can avoid it just by deleting this markedTimespan for the month view, and recreate for other views, like follows:

scheduler.attachEvent("onBeforeViewChange", function(old_mode,old_date,mode,date){
    if(mode != "month"){
        let timesp = scheduler.addMarkedTimespan({
            days:  new Date(),
            zones: [0*60,4*60], // 12 am to current time
            css:   "gray_section",
            type:  "dhx_time_block",
        });
    }
    if (mode == "month"){
        scheduler.deleteMarkedTimespan({
            days:  new Date(),
            zones: [0*60,4*60], // 12 am to current time
            css:   "gray_section",
            type:  "dhx_time_block",
        });
    }
    return true;
});

Here is a demo:
https://snippet.dhtmlx.com/6t5sovtm

Regarding this part:

Or how to only mark and not block dates in month view?

You can mark days in month view, with _class template functions, like month_date_class:
https://docs.dhtmlx.com/scheduler/api__scheduler_month_date_class_template.html