pub fn parse_time_component(s: &str, position: &mut usize) -> Option<NaiveTime>
Expand description
Low-level function for parsing an individual time component at a given position
This follows the rules for parsing a time component per WHATWG HTML Standard § 2.3.5.4 Times.
Note: This function exposes a lower-level API than
parse_time
. More than likely, you will want to useparse_time
instead.
§Examples
use chrono::NaiveTime;
use whatwg_datetime::parse_time_component;
let mut position = 0usize;
let date = parse_time_component("14:59", &mut position);
assert_eq!(date, NaiveTime::from_hms_opt(14, 59, 0));