Skip to content

Commit

Permalink
Replace 86_400 with MAX_RFC3339_OFFSET
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Feb 7, 2024
1 parent 5656a9e commit 51cb026
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/format/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ pub(crate) fn parse_rfc3339<'a>(parsed: &mut Parsed, mut s: &'a str) -> ParseRes
}

let offset = try_consume!(scan::timezone_offset(s, |s| scan::char(s, b':'), true, false, true));
if offset <= -86_400 || offset >= 86_400 {
const MAX_RFC3339_OFFSET: i32 = 86_400;
if !(-MAX_RFC3339_OFFSET..=MAX_RFC3339_OFFSET).contains(&offset) {
return Err(OUT_OF_RANGE);
}
parsed.set_offset(i64::from(offset))?;
Expand Down

0 comments on commit 51cb026

Please sign in to comment.