Why my gantt.setworktime is not working

I want to show only 8 to 5 time in gantt timeline scale and I am using approach that is mentioned below so please anyone help me.

gantt.config.fit_tasks = true;
gantt.config.work_time = true;
gantt.config.duration_unit = “hour”;
gantt.config.duration_step = 1;
gantt.config.skip_off_time = true;

    gantt.setWorkTime({ hours: ["8:00-17:00"] })

    gantt.config.scales = [
        { unit: "hour", step: 1, date: "%H" },
        { unit: "day", step: 1, date: "%d %M" },
    ];

Hello,
By default, the working hours are set from 08:00 to 12:00 and from 13:00 to 17:00. When you use the following command, you change these settings:

gantt.setWorkTime({ hours: ["8:00-17:00"] })

As you enabled the skip_off_time config, the non-working hours are not displayed (because there is the hour scale).
But if you disable that config, you will be able to see the difference:


Here is the snippet:
https://snippet.dhtmlx.com/fuik06ds

If you expect something different, please provide a more detailed description. And you can also share a picture that shows how you imagine it should look and work.

Hello,
If you enable the skip_off_time config, Gantt doesn’t show non-working hours if there is the hour scale:
https://docs.dhtmlx.com/gantt/api__gantt_skip_off_time_config.html

This is how it works in the snippet:

But that functionality works only in the Pro version:

So, if it doesn’t work in your case, it means that you didn’t install the Pro version in your React project.
You can do that the following way:

  1. Unpack Gantt to the root folder of your project, for example, to /opt/project_management_app/gantt
  2. Use the following command to install Gantt:
npm install /opt/project_management_app/gantt

You can read more about installation methods in the following article:
https://docs.dhtmlx.com/gantt/desktop__install_with_bower.html#addingproeditionintoproject

do I need to pay any charge for the pro version?

Hello,
Yes, the Pro version is not free, there are different prices depending on what you need:

You can also ask the Sales team if there are any available discounts:
info@dhtmlx.com

If you want to try how everything works in the Pro version, you can apply for the Trial version:
Get Trial version