---
name: next_cron_time
kind: function
lang: py
domain: core
version: "1.0.0"
purity: pure
signature: "next_cron_time(schedule: dict, after: datetime) -> datetime | None"
description: "Calcula la proxima ejecucion de un cron schedule despues de un tiempo dado. Avanza minuto a minuto saltando campos no coincidentes. Retorna None si no hay match en 366 dias (schedule imposible)."
tags: [cron, scheduling, time, next, pure, pendiente-usar]
uses_functions: [parse_cron_expr_py_core]
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: [datetime]
params:
  - name: schedule
    desc: "Diccionario de cron schedule parsado con parse_cron_expr"
  - name: after
    desc: "Datetime base desde el cual calcular la próxima ejecución"
output: "Próximo datetime cuando se ejecute el cron, o None si el schedule es imposible"
tested: true
tests:
  - "0 * * * * desde :30 retorna la proxima hora en punto"
  - "0 9 * * 1-5 desde viernes retorna proximo lunes a las 9"
  - "schedule imposible retorna None"
  - "paso */15 desde :05 retorna :15"
test_file_path: "python/functions/core/next_cron_time_test.py"
file_path: "python/functions/core/next_cron_time.py"
---

## Ejemplo

```python
from parse_cron_expr import parse_cron_expr
from next_cron_time import next_cron_time
from datetime import datetime

sched = parse_cron_expr("0 * * * *")
after = datetime(2024, 1, 15, 14, 30)
nxt = next_cron_time(sched, after)
# nxt = datetime(2024, 1, 15, 15, 0)

weekdays = parse_cron_expr("0 9 * * 1-5")
friday = datetime(2024, 1, 19, 10, 0)  # viernes
nxt2 = next_cron_time(weekdays, friday)
# nxt2 = datetime(2024, 1, 22, 9, 0)  # lunes
```

## Notas

Misma semantica que la version Go (next_cron_time_go_core). Usa AND para day_of_month y day_of_week.
El campo day_of_week usa convencion cron (0=domingo) convertido internamente a weekday() de Python.
Retorna None en lugar de lanzar excepcion para mantener purity (sin side effects).
