pub fn parse_numeric_offset(s: &str) -> Option<FixedOffset>Expand description
Parse exactly six ASCII bytes in signed ±HH:MM form into a fixed offset.
The sign, two hour digits, colon, and two minute digits are required. Minutes
must be at most 59, and the resulting offset must fit chrono’s FixedOffset
range. Returns None for malformed or out-of-range input, including
non-ASCII text, without panicking.
use relate_model::serde_value::parse_numeric_offset;
assert_eq!(parse_numeric_offset("+02:30").unwrap().local_minus_utc(), 9_000);
assert_eq!(parse_numeric_offset("-05:45").unwrap().local_minus_utc(), -20_700);
assert!(parse_numeric_offset("+00:60").is_none());
assert!(parse_numeric_offset("é+02:30").is_none());