Crate icalendar_duration

Source
Expand description

A parser implementation for durations as defined in RFC5545.

These are mostly used for alarms, to indicate their time relative to the time of an event or todo.

For convenience, Rfc5545Duration implements Add for icalendar::DatePerhapsTime, chrono::DateTime and chrono::naive::NaiveDateTime.

§Example

use chrono::TimeZone;
use chrono::Utc;

let duration = icalendar_duration::parse("PT24H")?;
let dt = Utc.ymd(2022, 9, 1).and_hms(22, 9, 14);

assert_eq!(dt + duration, Utc.ymd(2022, 9, 2).and_hms(22, 9, 14));

Structs§

Rfc5545Duration
The Duration specified in RFC554.

Enums§

Sign
The sign for a duration (which can be negative or positive).

Functions§

parse
Parses a string into Rfc5545Duration, as per the rules defined in RFC5545.