Skip to content

error when using '7' as Sunday in "Nth occurrence of weekday"  #13

@alpetric

Description

@alpetric

Basic reproduction

use croner::Cron;
use chrono::Local;

fn main() -> () {
    let count = 5;
    let start_time = Local::now();

    let schedule = Cron::new("0 0 0 * * 7#2")
        .with_seconds_optional()
        .parse()
        .expect("failed to parse schedule string");

    let events: Vec<_>  = schedule
        .iter_from(start_time)
        .take(count)
        .collect();
    
    println!("Next 5 events: {:?}", events);
    
    match schedule.find_next_occurrence(&start_time, true) {
        Ok(next) => println!("Next occurrence: {}", next),
        Err(e) => eprintln!("Error: {:?}", e),
    }

}

results in =>

➜  hello_world git:(master) ✗ cargo run
   Compiling hello_world v0.1.0 (/Users/alex/dev/personal/hello_world)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.29s
     Running `target/debug/hello_world`
Next 5 events: []
Error: TimeSearchLimitExceeded

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions