[][src]Type Definition timespan::NaiveDateSpan

type NaiveDateSpan = Span<NaiveDate>;

The NaiveDateSpan alias is a span consisting of chrono::NaiveDates.

It can be used to represent date spans that do not depend on a specific time zone (e.g. christmas).

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


use timespan::NaiveDateSpan;

let a: NaiveDateSpan = "2017-04-15 - 2017-08-15".parse().unwrap();
let b = NaiveDateSpan::parse_from_str(
    "15.04.17 - 15.08.17",
    "{start} - {end}",
    "%d.%m.%y", "%d.%m.%y"

let f = a.format("from {start} to {end}", "%m/%d", "%m/%d");
assert!(format!("{}", f) == "from 04/15 to 08/15");
assert!(a == b);