> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nextedy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Customize Working Hours per Resource

> Override the default working hours for individual resources using either a global setting or a custom script function in Nextedy GANTT.

export const LastReviewed = ({date}) => {
  if (!date) return null;
  const formatted = new Date(`${date}T00:00:00Z`).toLocaleDateString("en-US", {
    year: "numeric",
    month: "long",
    day: "numeric",
    timeZone: "UTC"
  });
  return <p className="mt-10 text-sm text-gray-400 dark:text-zinc-500 not-prose">
      Last reviewed on {formatted}
    </p>;
};

## Approach 1: Set a Uniform Value for All Resources

To change the default working hours for every resource in the project, use one of these methods:

### Option A: Gantt Config Script (Per Widget)

Add the following in **Widget Properties > Advanced > Gantt Config Script**:

```javascript theme={null}
gantt.config.workingHoursPerDay=7
```

This sets 7 working hours per day for all resources in this specific Gantt widget.

### Option B: Administration Property (Per Project or Server)

Add the following in **Administration > Configuration Properties**:

```
nextedy.gantt.workingHoursPerDay=7
```

This applies to all Gantt widgets in the project (or globally if set at the server level).

| Method                             | Scope             | Set In                                             |
| ---------------------------------- | ----------------- | -------------------------------------------------- |
| `gantt.config.workingHoursPerDay`  | Single widget     | Widget Properties > Advanced > Gantt Config Script |
| `nextedy.gantt.workingHoursPerDay` | Project or server | Administration > Configuration Properties          |

## Approach 2: Different Hours per Resource (Script Function)

For scenarios where different users have different working hours, define a custom function in the **Gantt Config Script**:

```javascript theme={null}
gantt.config.workingHoursPerDayFunction = (resource) => {
  if (resource === "jsmith") {
    return 4;
  }
  if (resource === "mdoe") {
    return 6;
  }
  return 8;
};
```

This function receives the resource ID (Polarion user ID) and returns the number of working hours for that user. The Gantt uses this value when calculating capacity in the resource view.

<Tip title="Dynamic Script with Velocity">
  The Gantt Config Script supports Velocity preprocessing on the server. You can use `$trackerService` to query work items and dynamically build the function. For example, read resource capacity from a custom work item and generate the JavaScript function body at render time.
</Tip>

### Example: Velocity-Powered Resource Hours

```javascript theme={null}
gantt.config.workingHoursPerDayFunction = (resource) => {
  #set($resources = $trackerService.queryWorkItems("type:teamAssignment", "id"))
  var mapping = {
    #foreach($wi in $resources)
    "$wi.getAssignees().iterator().next().getId()": $wi.getCustomField("hoursPerDay").get(),
    #end
  };
  return mapping[resource] || 8;
};
```

<Info title="Verify in application">
  The Velocity-based approach depends on your project's specific work item types and custom fields. Test the generated JavaScript output in the browser console to confirm correct values.
</Info>

## How It Affects the Resource View

The working hours value determines the **capacity denominator** in resource view calculations:

* **Time mode**: Shows allocated hours vs. available hours per day
* **Remaining mode**: Shows remaining capacity (available minus allocated)
* **Allocation mode**: Shows percentage (allocated / available \* 100)

When a resource has a custom value of 4 hours per day instead of the default 8, the resource view reflects this reduced capacity. A task assigned 4 hours fills the entire day for that resource.

<Frame>
  <img src="https://mintcdn.com/none-17b4493f/DDjWgCW2DWY5biNv/gantt/diagrams/guides/calendars/working-hours-per-resource/diagram-1.svg?fit=max&auto=format&n=DDjWgCW2DWY5biNv&q=85&s=b5927a235d8d15471e77190faa1c56c4" alt="diagram" style={{ maxWidth: "520px", width: "100%" }} width="520" height="130" data-path="gantt/diagrams/guides/calendars/working-hours-per-resource/diagram-1.svg" />
</Frame>

<Warning title="Interaction with Working Calendars">
  If you also use work item calendars or CSV calendars, the per-resource working hours from those calendars take precedence over the `workingHoursPerDayFunction`. The script function acts as a fallback when no calendar-based hours are available for a resource.
</Warning>

## Verify

You should now see that resource view capacity markers reflect the customized hours per resource. Resources with reduced hours show higher utilization percentages for the same amount of assigned work.

## See Also

* [Set Up Work Item Calendars](/gantt/guides/calendars/work-item-calendar)
* [Import Calendars from CSV](/gantt/guides/calendars/csv-calendar-import)
* [Configure Capacity Modifier Fields](/gantt/guides/calendars/capacity-modifier-fields)
* [Set Up the Resource View](/gantt/guides/resources/resource-view)
* [Write Gantt Config Scripts](/gantt/guides/scripting/gantt-config-script)

<LastReviewed date="2026-07-02" />
