You've already forked parse_datetime
mirror of
https://github.com/uutils/parse_datetime.git
synced 2026-06-10 16:13:15 -07:00
Merge branch 'main' into main
This commit is contained in:
Generated
+2
-2
@@ -343,9 +343,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.7.10"
|
||||
version = "0.7.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec"
|
||||
checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
+16
-1
@@ -258,10 +258,18 @@ pub fn parse(input: &mut &str) -> ModalResult<Vec<Item>> {
|
||||
if time_seen {
|
||||
return Err(expect_error(input, "time cannot appear more than once"));
|
||||
}
|
||||
time_seen = true;
|
||||
|
||||
if t.offset.is_some() {
|
||||
if tz_seen {
|
||||
return Err(expect_error(
|
||||
input,
|
||||
"timezone cannot appear more than once",
|
||||
));
|
||||
}
|
||||
tz_seen = true;
|
||||
}
|
||||
|
||||
time_seen = true;
|
||||
}
|
||||
Item::Year(_) => {
|
||||
if year_seen {
|
||||
@@ -591,6 +599,13 @@ mod tests {
|
||||
.to_string()
|
||||
.contains("timezone cannot appear more than once"));
|
||||
|
||||
let result = parse(&mut "m1y");
|
||||
assert!(result.is_err());
|
||||
assert!(result
|
||||
.unwrap_err()
|
||||
.to_string()
|
||||
.contains("timezone cannot appear more than once"));
|
||||
|
||||
let result = parse(&mut "2025-05-19 abcdef");
|
||||
assert!(result.is_err());
|
||||
assert!(result.unwrap_err().to_string().contains("unexpected input"));
|
||||
|
||||
Reference in New Issue
Block a user