> ## 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.

# shift

```ts theme={null}
function shift(
   id,
   startTime,
   endTime,
   opts?): ShiftPattern;
```

Define a shift option with a fixed time window.

## Parameters

<ResponseField name="id" type="string" required>
  Unique identifier for this shift pattern
</ResponseField>

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

  Time the assignment starts
</ResponseField>

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

  Time the assignment ends
</ResponseField>

<ResponseField name="opts" type="Pick\<[ShiftPattern](./ShiftPattern), &#x22;dayOfWeek&#x22; | &#x22;roleIds&#x22; | &#x22;locationId&#x22;\>">
  Optional `roleIds`, `dayOfWeek`, and `locationId` scoping
</ResponseField>

## Returns

[`ShiftPattern`](./ShiftPattern)

Shift patterns define the shift options the solver may assign to eligible members on
qualifying days. By default, a pattern is available on every scheduling day. Use
options to restrict the pattern to specific days, roles, or a location.

Declaring a pattern does not require the solver to use it. When assigned, a pattern
spans the full `startTime` to `endTime`; patterns are not split or trimmed.
