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

# timeSurcharge

```ts theme={null}
function timeSurcharge(
   amountPerHour,
   window,
opts?): RuleEntry<"time-cost-surcharge", object & CostRuleOptions>;
```

Adds a flat surcharge per hour for the portion of a shift that overlaps a time-of-day window.

## Parameters

<ResponseField name="amountPerHour" type="number" required>
  Flat surcharge per hour in smallest currency unit
</ResponseField>

<ResponseField name="window" required>
  Time-of-day window

  <Expandable title="properties">
    <ResponseField name="from" required>
      [`TimeOfDay`](./TimeOfDay)
    </ResponseField>

    <ResponseField name="until" required>
      [`TimeOfDay`](./TimeOfDay)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="opts">
  [`CostRuleOptions`](./CostRuleOptions)

  Entity and time scoping
</ResponseField>

## Returns

`RuleEntry`\<`"time-cost-surcharge"`, `object` & [`CostRuleOptions`](./CostRuleOptions)>

The window supports overnight spans (e.g., 22:00-06:00). The surcharge
is independent of the member's base rate.
