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
The Duration specified in RFC554.
Enums
The sign for a duration (which can be negative or positive).
Functions
Parses a string into Rfc5545Duration
, as per the rules defined in RFC5545.