Skip to content

Commit c05b821

Browse files
authored
Merge branch 'main' into main
2 parents 41a53a2 + 03cff2c commit c05b821

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/items/mod.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,18 @@ pub fn parse(input: &mut &str) -> ModalResult<Vec<Item>> {
258258
if time_seen {
259259
return Err(expect_error(input, "time cannot appear more than once"));
260260
}
261-
time_seen = true;
261+
262262
if t.offset.is_some() {
263+
if tz_seen {
264+
return Err(expect_error(
265+
input,
266+
"timezone cannot appear more than once",
267+
));
268+
}
263269
tz_seen = true;
264270
}
271+
272+
time_seen = true;
265273
}
266274
Item::Year(_) => {
267275
if year_seen {
@@ -591,6 +599,13 @@ mod tests {
591599
.to_string()
592600
.contains("timezone cannot appear more than once"));
593601

602+
let result = parse(&mut "m1y");
603+
assert!(result.is_err());
604+
assert!(result
605+
.unwrap_err()
606+
.to_string()
607+
.contains("timezone cannot appear more than once"));
608+
594609
let result = parse(&mut "2025-05-19 abcdef");
595610
assert!(result.is_err());
596611
assert!(result.unwrap_err().to_string().contains("unexpected input"));

0 commit comments

Comments
 (0)