Customize "date_scale"

Hi there,
I want to customize “gantt.config.date_scale”. Do I have a way to combine 2 “days” into 1 “days” and use the “day” I just combined as a new unit of measurement?

Hi @longhai,
The first way you can do this is to use the ‘day’ unit with step:2 and custom format function to show two days in one cell, like in the following snippet:

If it is not the thing you need, you can create a custom time unit,
doubleDay, which will be 2 days long.
To create custom doubleDay unit , you should define its logic in the methods. After that, you will be able to add this unit into the gantt.config.scale and use it like default time units.
Here is the snippet:

Also, you can combine both ways, and use different step with custom units, like in the snippet below, where I used the doubleDay unit with step:2 to create quadraDay on the scale:

Important: In these examples, I used gantt.config.scale because gantt.config.date_scale is deprecated.
API list:
custom time units
I didn’t fully understand what you meat as use the “day” I just combined as a new unit of measurement?, so if I didn’t answer your question, could you please clarify it?

1 Like

Yo!! many thanks @Siarhei. Now i can create a custom time unit hehe ^^~