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

# Flexible days vs. block days

> Learn the difference between flexible and block vacation ranges, when each type applies, and how the Friday rule affects date selection.

Each 30-day vacation period is divided into two distinct types of days. The type is determined automatically by the number of days in the requested range — you do not choose it manually.

## Overview

<Tabs>
  <Tab title="Flexible days">
    **Flexible days** are designed for short breaks throughout the year. An employee can use up to **7 flexible days per period**, spread across one or more ranges.

    * Minimum range length: **1 day**
    * Maximum range length: **7 consecutive days**
    * Total available per period: **7 days**
    * Stored on the schedule as `diasFlexiblesDisponibles: 7`

    Once all 7 flexible days have been used, any remaining ranges must be taken as block days (minimum 7 consecutive days).

    <Tip>
      Flexible days are ideal for long weekends, personal appointments, or one-off days off. They can be taken as a single day at a time.
    </Tip>
  </Tab>

  <Tab title="Block days">
    **Block days** are designed for the main vacation. A block range must span at least **7 consecutive days**.

    * Minimum range length: **7 consecutive days**
    * No maximum (up to remaining block balance)
    * Total available per period: **23 days**
    * Stored on the schedule as `diasBloqueDisponibles: 23`

    <Tip>
      Block days are best planned well in advance. A common pattern is one 14-day block and one 9-day block.
    </Tip>
  </Tab>
</Tabs>

## How the type is assigned

The system inspects the number of days in a submitted range and assigns the type automatically:

```
days ≤ 7 AND flexible balance remaining  →  tipo: "flexible"
days > 7  OR  flexible balance exhausted  →  tipo: "bloque"
```

This logic lives in `RegistroVacaciones.tsx` (`esFlexible` flag at line 248) and is enforced again in `validarRangoVacaciones` in `vacationUtils.ts`.

## Comparison table

| Property        | Flexible                   | Block                     |
| --------------- | -------------------------- | ------------------------- |
| `tipo` value    | `"flexible"`               | `"bloque"`                |
| Minimum days    | 1                          | 7                         |
| Maximum days    | 7                          | No limit (within balance) |
| Days per period | 7                          | 23                        |
| Counter field   | `diasFlexiblesUsados`      | `diasBloqueUsados`        |
| Typical use     | Long weekends, single days | Main annual vacation      |

## Validation rules

The system prevents invalid requests with these checks:

* You cannot start a range on a Saturday or Sunday.
* If your flexible balance is 0, ranges of 7 days or fewer are blocked with an error.
* If a requested range exceeds the remaining balance for its type, the request is rejected.
* Ranges cannot overlap with already-scheduled ranges in the same period.

## The Friday rule

When you select a **Friday** as the start date or end date of a range, the system automatically extends the end date to the following Sunday. The extra two days (Saturday and Sunday) are included in the `diasSolicitados` count, and the range is flagged with `incluye_finde: true`.

This behaviour is enforced in two places:

* **`calcularDiasConFinDeSemana`** in `vacationUtils.ts` — sets `incluye_finde: true` when either boundary is a Friday.
* **`RegistroVacaciones.tsx`** — watches the date inputs and automatically updates `fechaFin` to the Sunday when a Friday is selected, showing a toast notification.

<Warning>
  The two weekend days count against the employee's vacation balance. A range from Friday to Sunday costs 3 days, not 1.
</Warning>

Ranges that triggered the Friday rule are displayed with an **"Incluye fin de semana"** badge in the scheduled ranges list.

## Example

An employee takes the following ranges during their `"2025-2026"` period:

| Date range           | Days | Type     | Notes                |
| -------------------- | ---- | -------- | -------------------- |
| 3–4 March 2026       | 2    | Flexible | Long weekend         |
| 7–21 July 2026       | 14   | Block    | Main summer vacation |
| 14–23 September 2026 | 9    | Block    | Second block         |

**Totals used:** 2 flexible + 23 block = **25 days**\
**Remaining:** 5 flexible + 0 block = **5 days**

<Note>
  Once block days are exhausted, any remaining flexible days can still be used in ranges of up to 7 days. However, once flexible days are exhausted, all remaining days must be taken in blocks of at least 7 consecutive days.
</Note>
