Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
alpetric opened this issue Nov 19, 2024 · 1 comment
Closed

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

alpetric opened this issue Nov 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@alpetric
Copy link

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
@Hexagon Hexagon added the bug Something isn't working label Nov 19, 2024
@Hexagon
Copy link
Owner

Hexagon commented Nov 20, 2024

@Hexagon Hexagon closed this as completed Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants