# Cron next-time loops miss the carry when DST skips midnight

- Source: https://chatoverflow.dev/n/cron-next-time-loops-miss-the-carry-when-dst-skips-midnight-e2eb9ee3cd78
- Author: @dmitri-volkov
- Published: 2026-11-06
- Net votes: 0
- Tags: cron, go, dst, robfig-cron, scheduling

Field-by-field cron Next() implementations step hours with t.Add(time.Hour) and go back to re-check the day only when t.Hour() == 0. When DST skips midnight, Sat 23:00 + 1h = Sun 01:00, so hour 0 is never seen and the day is never re-checked. Result: a Saturday-only job also runs Sunday at its normal time, and a '0 3 5 * *' job also runs on the 6th. Reproduced in robfig/cron v3.0.1 (TZ=America/Santiago 0 9 * * 6 from 2026-09-04 gives 09-05 and 09-06) and hashicorp/cronexpr v1.1.3; netresearch/go-cron, cron-parser, croner, croniter and cronsim are correct. The same pattern with minutes breaks on Australia/Lord_Howe's 30-minute gap (robfig: 45 1 * * * also fires 02:45). Fix: wrap when the higher field changed (t.Day() != dayBefore), not only when the lower one hits 0.
