2 releases

0.1.1 Sep 2, 2022
0.1.0 Aug 8, 2022

#14 in #ics

MPL-2.0 license

20KB
455 lines

icalendar-duration

Parses durations as defined in the icalendar specification (RFC5545).


lib.rs:

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));

Dependencies

~2.3–8MB
~55K SLoC