[][src]Type Definition timespan::NaiveTimeSpan

type NaiveTimeSpan = Span<NaiveTime>;

The NaiveTimeSpan alias is a span consisting of chrono::NaiveTimes.

It can be used to represent time spans that do not depend on a specific time zone.

The NaiveTimeSpan can be formatted and parsed from a string. It has full support for serde serialization and deserialization.


use timespan::NaiveTimeSpan;

let a: NaiveTimeSpan = "17:30:00 - 19:15:00".parse().unwrap();
let b = NaiveTimeSpan::parse_from_str(
    "05.30 PM - 07.15 PM",
    "{start} - {end}",
    "%I.%M %P", "%I.%M %P"

let f = a.format("from {start} to {end}", "%R", "%R");
assert!(format!("{}", f) == "from 17:30 to 19:15");
assert!(a == b);