Overview
The Calendar Deadlines API manages días inhábiles (non-working days) that affect business day calculations across the sistema. When días inhábiles are added or removed, the system automatically recalculates response deadlines for all active solicitudes.Base Route
All endpoints are prefixed with:Días Inhábiles
Días inhábiles are specific dates marked as non-working days (holidays, special closures, etc.). These dates are excluded from business day calculations in addition to regular weekends. When días inhábiles are modified, the system triggers automatic recalculation of all solicitud deadlines to ensure accuracy.Endpoints
Get Días Inhábiles
DiaInhabilManual table.
Response (200 OK):
fecha(DateTime): The date marked as inhábil (normalized to date only, no time component)
Add Día Inhábil
- Date is normalized to date-only (time component removed)
- Checks if the date already exists in
DiaInhabilManual - If new, adds the date to the table
- Triggers automatic recalculation of all solicitud deadlines
- Returns success message
Delete Día Inhábil
fecha(DateTime): The date to remove (format:2026-12-24)
DiaInhabilManual table.
Behavior:
- Date is normalized to date-only
- Searches for the date in
DiaInhabilManual - If found, removes the record
- Triggers automatic recalculation of all solicitud deadlines
- Returns 204 No Content
Automatic Deadline Recalculation
When días inhábiles are added or removed, the system executes theRecalcularFechasLimiteEnSolicitudes() method, which:
Recalculation Process
-
Fetch Current Días Inhábiles: Retrieves all dates from
DiaInhabilManual -
Retrieve Expedientes: Gets all expedientes from the
Expedientestable whereFechaIniciois not null -
For Each Expediente:
a. Determine Business Days Required:
- DAI: 10 business days
- ARCO: 20 business days
- If
Ampliacion == "SI": Double the days (20 or 40)
- Start from
FechaInicio.Date - Iterate day-by-day:
- Skip if Saturday or Sunday (
DayOfWeek.SaturdayorDayOfWeek.Sunday) - Skip if date exists in días inhábiles list
- Otherwise, count as 1 business day and decrement counter
- Skip if Saturday or Sunday (
- Continue until required business days reached
- DAI: Set
FechaLimiteRespuesta10dias, clearFechaLimiteRespuesta20dias - ARCO: Set
FechaLimiteRespuesta20dias, clearFechaLimiteRespuesta10dias
- Save Changes: Commits all updated expedientes to the database
Code Reference
The recalculation logic is implemented in CalendarioController.cs:130-181:Performance Considerations
- Recalculation processes all expedientes with a
FechaInicio - For large datasets, this operation may take time
- The operation runs synchronously, so the API response waits for completion
- Consider running during off-peak hours for bulk día inhábil updates
Example Scenario
Initial State:- Expediente created on March 10, 2026 (Monday)
- Type: DAI (10 business days)
- No ampliación
- No días inhábiles
- Calculated deadline: March 24, 2026 23:59:59
- POST to
/api/Calendario/Guardar_DiasInhabileswith March 18 - System recalculates all deadlines
- March 18 now excluded from business day count
- New deadline: March 25, 2026 23:59:59
- DELETE to
/api/Calendario/Eliminar_DiaInhabil/2026-03-18 - System recalculates all deadlines
- March 18 now included in business day count
- Reverted deadline: March 24, 2026 23:59:59
Integration Notes
Database Tables
- DiaInhabilManual: Stores manually configured non-working days
- Calendario: Stores active/inactive status for specific dates
- Expedientes: Contains solicitudes with
FechaInicioand deadline fields
Related Fields in Expedientes
FechaInicio: Start date for deadline calculationTipoSolicitud: “DAI” or “ARCO”Ampliacion: “SI” or other valueFechaLimiteRespuesta10dias: Deadline for DAI requestsFechaLimiteRespuesta20dias: Deadline for ARCO requests
Business Rules
- Only expedientes with
FechaInicio != nullare recalculated - Weekends (Sat/Sun) are always excluded
- Días inhábiles are always excluded
- Deadlines end at 23:59:59 on the calculated date
- DAI and ARCO use separate deadline fields
- Ampliación doubles the required business days