scroll to first day of month in custom timeline view

I’m trying to set the date in the scale of a custom timeline “Day” view. I would like it to start from the first day of the month to the last day of the month every time I click on the next, previous, today, and day buttons.

Here is an image of what it looks like

imgur.com/fxRwkFf

I would like the scale to show from may 01 to may 31. But it shows from may 17 to june 15.

This is what I have so far but it does not change the dates.

        scheduler.attachEvent("onBeforeViewChange", function (old_mode, old_date, mode, date) {

            if (mode === 'dtimeline') {

                if (old_date.getTime() === date.getTime() && old_mode === mode)
                    return false;
                let d = scheduler.getState().date;
                let minDate = scheduler.getState().min_date;
                let maxDate = scheduler.getState().max_date;
                scheduler.setCurrentView(d);
            }
            if (old_date) {
                if (+date > +old_date) {//scroll forward
                   
                } else if (+date < +old_date) {//scroll backward
                    
                }
            }
            return true;
        });

I’m changing the dates when I click on the custom view, hit the previous, next, and today buttons.
Check the link below for instructions.

[code]

defineCustomView() {
    //https://docs.dhtmlx.com/scheduler/custom_views.html

    scheduler.date.dtimeline_start = function (date) {

        date.setDate(1);
        return scheduler.date.day_start(date);//
    }

    scheduler.date.get_dtimeline_end = function (start_date) {
        return scheduler.date.add(start_date, 7, "day");
    }

    scheduler.date.add_dtimeline = function (date, inc) {

        let days = new Date(date.getFullYear(), date.getMonth(), 0).getDate();

        if(inc === 1)
            days = new Date(date.getFullYear(), date.getMonth() + 2, 0).getDate();

        scheduler.matrix['dtimeline'].x_size = days;
        scheduler.setCurrentView();

        let finalDate = scheduler.date.add(date, inc * 1, "month");

        return finalDate;
    }.bind(this);
}[/code]

Hi,
Please check in the sample how to implement it
docs.dhtmlx.com/scheduler/sampl … scale.html