Skip to main content

normalize_schedule

Function normalize_schedule 

Source
pub fn normalize_schedule(schedule: &str) -> String
Expand description

Adapt an operator-written cron expression to the 6-field form the cron crate parses.

Operators write standard 5-field cron (min hour dom mon dow) — that is what crontab, Kubernetes CronJob and every scheduling UI mean by “cron”. The cron crate instead expects a leading seconds field, so a plain */5 * * * * would silently parse as every 5 seconds rather than every 5 minutes. Prepending 0 pins such a schedule to the top of its minute.

A 6- or 7-field expression is passed through untouched, so the crate’s own seconds/year syntax stays available to anyone who wants it.