mirror of
https://github.com/bspeice/dtparse
synced 2025-07-03 06:45:01 -04:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
081cd7bea0 | |||
c3d6730e9c |
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "dtparse"
|
name = "dtparse"
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
authors = ["Bradlee Speice <bradlee@speice.io>"]
|
authors = ["Bradlee Speice <bradlee@speice.io>"]
|
||||||
description = "A dateutil-compatible timestamp parser for Rust"
|
description = "A dateutil-compatible timestamp parser for Rust"
|
||||||
repository = "https://github.com/bspeice/dtparse.git"
|
repository = "https://github.com/bspeice/dtparse.git"
|
||||||
|
@ -1132,7 +1132,9 @@ impl Parser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if idx + 3 < len_l && &tokens[idx + 3] == sep {
|
if idx + 3 < len_l && &tokens[idx + 3] == sep {
|
||||||
if let Some(value) = info.month_index(&tokens[idx + 4]) {
|
if tokens.len() <= idx + 4 {
|
||||||
|
return Err(ParseError::UnrecognizedFormat);
|
||||||
|
} else if let Some(value) = info.month_index(&tokens[idx + 4]) {
|
||||||
ymd.append(value as i32, &tokens[idx + 4], Some(YMDLabel::Month))?;
|
ymd.append(value as i32, &tokens[idx + 4], Some(YMDLabel::Month))?;
|
||||||
} else if let Ok(val) = tokens[idx + 4].parse::<i32>() {
|
} else if let Ok(val) = tokens[idx + 4].parse::<i32>() {
|
||||||
ymd.append(val, &tokens[idx + 4], None)?;
|
ymd.append(val, &tokens[idx + 4], None)?;
|
||||||
|
@ -97,3 +97,10 @@ fn github_36() {
|
|||||||
let parse_result = parse(parse_str);
|
let parse_result = parse(parse_str);
|
||||||
assert!(parse_result.is_err());
|
assert!(parse_result.is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn github_45() {
|
||||||
|
assert!(parse("/2018-fifa-").is_err());
|
||||||
|
assert!(parse("/2009/07/").is_err());
|
||||||
|
assert!(parse("2021-09-").is_err());
|
||||||
|
}
|
Reference in New Issue
Block a user