Remove duration unit from duration column


I need to remove duration unit (refer below screenshot) from duration column (i.e. if the duration is 5 days, I would like to display it as 5 without ‘days’ text in the duration column).

Could you please guide me to achieve this.

Thank you.

I assume you are using durationFormatter(), because by default “days” is not displayed in the “Duration” column.
If so, you can set the display of different units of time in the “durationFormatter” configuration and remove “days” from the labels:

var dayFormatter = gantt.ext.formatters.durationFormatter({
    enter: "day", 
    store: "minute", 
    format: "day",
    labels: {
        day: {
            full: "",
            plural: "",
            short: ""

Here is an example in the snippet:

Instead of a “durationFormatter” you can use template:

{ name: "duration", label: "Duration", resize: true, align: "center", template: task => task.duration, width: 100 }

If you have additional questions, write to us, and we will try to help you.

1 Like

Hi Maksim,

Yes, I was using durationFormatter().

Thank you.

1 Like