flashman
← All posts

Cron month-end and leap-day schedule debugging

Debug calendar cron gaps by testing short months and leap years, defining fallback dates, separating timezone rules, and monitoring the next expected run.

2026-08-31 · 6 min read · Rahul Chitturi

  • cron
  • scheduling
  • reliability

A cron expression for day 31 does not mean the last day of every month. It simply has no matching date in shorter months. A February 29 schedule similarly has no occurrence during an ordinary year.

These gaps are easy to miss when a preview window covers only the current month or a test suite advances time by fixed durations instead of calendar boundaries.

Write the business rule in words

Decide whether the requirement means a specific numbered day, the final calendar day, the final business day, or a fixed interval. Traditional five-field cron cannot express every calendar rule directly.

  • Preview at least one full leap-year cycle for annual jobs
  • Test February and every 30-day month for month-end work
  • Keep timezone and daylight-saving behavior explicit
  • Document whether a missed date is skipped or recovered

Use a daily trigger for richer rules

For last-day or business-calendar logic, a simple daily schedule plus an idempotent application check is often clearer than multiple overlapping expressions. Persist a logical period key so retries and duplicate dispatch cannot repeat side effects.

Monitor the next expected logical run, not only scheduler health. A scheduler can be operating correctly while an impossible date silently produces no execution.

A Flashman workflow

Use the cron helper to preview candidate expressions, timestamp converter to align actual runs, JSON formatter to inspect scheduler events, and diff to review schedule configuration changes.

Test short months, leap and non-leap years, year boundaries, timezone transitions, delayed dispatch, duplicate delivery, and recovery after a disabled schedule.

Try these tools