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

# Weekend Definition

> Configure what constitutes a weekend for idle weekend constraints

Define your organization's weekend boundaries for rules that reference idle weekends, such as `WEEKENDS_IDLE` counters.

## Why Define Weekends?

Different industries and regions have varying definitions of "weekend":

* **Standard**: Friday evening to Sunday night
* **Retail/Hospitality**: Saturday morning to Monday morning
* **Healthcare**: 36-hour blocks with specific start times

## Basic Weekend Definition

Set the weekend boundaries in the `options.idleWeekend` object:

```json theme={null}
{
  "options": {
    "idleWeekend": {
      "fromDayOfWeek": "FRIDAY",
      "fromTime": "19:00:00",
      "toDayOfWeek": "SUNDAY",
      "toTime": "23:00:00"
    }
  }
}
```

<Info>
  A weekend is considered "idle" if the employee has no shifts during the entire defined window.
</Info>

## Weekend Properties

<ParamField body="fromDayOfWeek" type="string" required>
  Day when the weekend starts: `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`, `SATURDAY`, `SUNDAY`
</ParamField>

<ParamField body="fromTime" type="string" required>
  Time when the weekend starts (HH:mm:ss format)
</ParamField>

<ParamField body="toDayOfWeek" type="string" required>
  Day when the weekend ends
</ParamField>

<ParamField body="toTime" type="string" required>
  Time when the weekend ends (HH:mm:ss format)
</ParamField>

<ParamField body="restTime" type="string (ISO 8601 duration)">
  Minimum consecutive idle time within the window to count as a free weekend
</ParamField>

## Common Weekend Configurations

<Tabs>
  <Tab title="Standard">
    Friday 7 PM to Sunday 11 PM:

    ```json theme={null}
    {
      "options": {
        "idleWeekend": {
          "fromDayOfWeek": "FRIDAY",
          "fromTime": "19:00:00",
          "toDayOfWeek": "SUNDAY",
          "toTime": "23:00:00"
        }
      }
    }
    ```
  </Tab>

  <Tab title="Retail">
    Saturday 8 AM to Monday 8 AM:

    ```json theme={null}
    {
      "options": {
        "idleWeekend": {
          "fromDayOfWeek": "SATURDAY",
          "fromTime": "08:00:00",
          "toDayOfWeek": "MONDAY",
          "toTime": "08:00:00"
        }
      }
    }
    ```
  </Tab>

  <Tab title="Healthcare">
    Saturday midnight to Monday 6 AM:

    ```json theme={null}
    {
      "options": {
        "idleWeekend": {
          "fromDayOfWeek": "SATURDAY",
          "fromTime": "00:00:00",
          "toDayOfWeek": "MONDAY",
          "toTime": "06:00:00"
        }
      }
    }
    ```
  </Tab>
</Tabs>

## Using Weekend Rules

Once defined, use weekend constraints in rules:

```json theme={null}
{
  "rules": [
    {
      "constraint": "COUNTER",
      "type": "WEEKENDS_IDLE",
      "min": 2,
      "period": {
        "from": "2024-01-01",
        "to": "2024-01-31"
      }
    }
  ],
  "options": {
    "idleWeekend": {
      "fromDayOfWeek": "FRIDAY",
      "fromTime": "19:00:00",
      "toDayOfWeek": "SUNDAY",
      "toTime": "23:00:00"
    }
  }
}
```

<Check>
  Each employee gets at least 2 completely free weekends in January.
</Check>

## Rest Time Requirement

Use `restTime` to require a minimum consecutive rest period within the weekend window:

```json theme={null}
{
  "options": {
    "idleWeekend": {
      "fromDayOfWeek": "FRIDAY",
      "fromTime": "19:00:00",
      "toDayOfWeek": "SUNDAY",
      "toTime": "23:00:00",
      "restTime": "PT36H"
    }
  }
}
```

<Tip>
  With `restTime`, an employee can work part of the weekend and still have it count as "idle" if they get 36 consecutive hours off within the window.
</Tip>
