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

bug: if timezone only has hour_offset but the string end with a : will cause panic #46

Open
TCeason opened this issue Jul 16, 2024 · 0 comments

Comments

@TCeason
Copy link

TCeason commented Jul 16, 2024

How to reproduce

dtparse is a good project that can resolve more parse questions. But I find a bug will cause panic:

use chrono::NaiveDateTime;
use dtparse::parse;

pub fn parse_dates(test_dates: &[&str]) {
    for date_str in test_dates {

        match parse(date_str) {
            Ok((naive_dt, _tz)) => {
                println!("Parsing: {}, success: {:?}", date_str, naive_dt);
            }
            Err(err) => {
                println!("Parsing: {},  - dtparse Failed: {}", date_str,  err);
            }
        }

        println!("");
    }
}

fn main() {
    let test_cases = vec![
        "2000-01-01 12:00:00+00:"
    ];
    parse_dates(&test_cases);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant