Type Alias timespan::naive::NaiveDateSpan

source ·
pub type NaiveDateSpan = Span<NaiveDate>;
Expand description

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.

§Example

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"
).unwrap();

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

Aliased Type§

struct NaiveDateSpan {
    pub start: NaiveDate,
    pub end: NaiveDate,
}

Fields§

§start: NaiveDate

The starting point of the span.

§end: NaiveDate

The end point of the span.