File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -258,10 +258,18 @@ pub fn parse(input: &mut &str) -> ModalResult<Vec<Item>> {
258
258
if time_seen {
259
259
return Err ( expect_error ( input, "time cannot appear more than once" ) ) ;
260
260
}
261
- time_seen = true ;
261
+
262
262
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
+ }
263
269
tz_seen = true ;
264
270
}
271
+
272
+ time_seen = true ;
265
273
}
266
274
Item :: Year ( _) => {
267
275
if year_seen {
@@ -591,6 +599,13 @@ mod tests {
591
599
. to_string( )
592
600
. contains( "timezone cannot appear more than once" ) ) ;
593
601
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
+
594
609
let result = parse ( & mut "2025-05-19 abcdef" ) ;
595
610
assert ! ( result. is_err( ) ) ;
596
611
assert ! ( result. unwrap_err( ) . to_string( ) . contains( "unexpected input" ) ) ;
You can’t perform that action at this time.
0 commit comments