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>> {
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" ) ) ;
You can’t perform that action at this time.
0 commit comments