[][src]Crate cron_parser

Library for parsing cron syntax, returning the next available date.

Example:

use chrono::{TimeZone, Utc};
use cron_parser::parse;

fn main() {
   if let Ok(next) = parse("*/5 * * * *", Utc::now()) {
        println!("when: {}", next);
   }

   // passing a custom timestamp
   if let Ok(next) = parse("0 0 29 2 *", Utc.timestamp(1893456000, 0)) {
        println!("next leap year: {}", next);
        assert_eq!(next.timestamp(), 1961625600);
   }

   assert!(parse("2-3,9,*/15,1-8,11,9,4,5 * * * *", Utc::now()).is_ok());
   assert!(parse("* * * * */Fri", Utc::now()).is_err());
}

Enums

ParseError

Functions

parse

Parse cron syntax

parse_field

parse_field Allowed special characters: